10.41 Effect on Data Storage

20180721 When the names of the variables within a dataset are changed R does not make a complete new copy of the dataset. Instead, the actual data in the column remains in tack whilst the variable itself (ds) references a new memory location where the new variable names get noted. The underlying data within the table is unaffected.

lobstr::ref(weather)
## █ [1:0x5def871a4e80] <tibble[,24]> 
## ├─Date=[2:0x5def81bd1c80] <date> 
## ├─Location=[3:0x5def753519a0] <chr> 
## ├─MinTemp=[4:0x5def7eb5f140] <dbl> 
## ├─MaxTemp=[5:0x5def7bbfe9c0] <dbl> 
## ├─Rainfall=[6:0x5def82cd76a0] <dbl> 
## ├─Evaporation=[7:0x5def7a8649e0] <dbl> 
## ├─Sunshine=[8:0x5def80fff450] <dbl> 
## ├─WindGustDir=[9:0x5def823a2800] <ord> 
## ├─WindGustSpeed=[10:0x5def8337d910] <dbl> 
## ├─WindDir9am=[11:0x5def8266e4a0] <ord> 
## ├─WindDir3pm=[12:0x5def8597da30] <ord> 
## ├─WindSpeed9am=[13:0x5def7bd2dc70] <dbl> 
## ├─WindSpeed3pm=[14:0x5def82d678b0] <dbl> 
## ├─Humidity9am=[15:0x5def7b940be0] <int> 
## ├─Humidity3pm=[16:0x5def7e504890] <int> 
## ├─Pressure9am=[17:0x5def81bd2ad0] <dbl> 
## ├─Pressure3pm=[18:0x5def8377b7b0] <dbl> 
## ├─Cloud9am=[19:0x5def8299fcc0] <int> 
## ├─Cloud3pm=[20:0x5def832c38e0] <int> 
## ├─Temp9am=[21:0x5def78246640] <dbl> 
## ├─Temp3pm=[22:0x5def80fd07c0] <dbl> 
## ├─RainToday=[23:0x5def83a9bcc0] <fct> 
## ├─RISK_MM=[24:0x5def80c3e590] <dbl> 
## └─RainTomorrow=[25:0x5def81023a50] <fct>
lobstr::ref(ds)
## █ [1:0x5def89173500] <tibble[,24]> 
## ├─date=[2:0x5def7e8a20c0] <date> 
## ├─location=[3:0x5def7c942130] <chr> 
## ├─min_temp=[4:0x5def7be40b40] <dbl> 
## ├─max_temp=[5:0x5def7eb70580] <dbl> 
## ├─rainfall=[6:0x5def7ed2b760] <dbl> 
## ├─evaporation=[7:0x5def7f98b250] <dbl> 
## ├─sunshine=[8:0x5def7fb46430] <dbl> 
## ├─wind_gust_dir=[9:0x5def7f8a6570] <ord> 
## ├─wind_gust_speed=[10:0x5def7cfb9bd0] <dbl> 
## ├─wind_dir_9am=[11:0x5def7f7acee0] <ord> 
## ├─wind_dir_3pm=[12:0x5def7bffbd20] <ord> 
## ├─wind_speed_9am=[13:0x5def7d174db0] <dbl> 
## ├─wind_speed_3pm=[14:0x5def7d32ff90] <dbl> 
## ├─humidity_9am=[15:0x5def7d4eb170] <int> 
## ├─humidity_3pm=[16:0x5def7eee6940] <int> 
## ├─pressure_9am=[17:0x5def7da0a7a0] <dbl> 
## ├─pressure_3pm=[18:0x5def7dbc5980] <dbl> 
## ├─cloud_9am=[19:0x5def7e758bc0] <int> 
## ├─cloud_3pm=[20:0x5def7c572aa0] <int> 
## ├─temp_9am=[21:0x5def7dd80b60] <dbl> 
## ├─temp_3pm=[22:0x5def7df3bd40] <dbl> 
## ├─rain_today=[23:0x5def7fd01610] <fct> 
## ├─risk_mm=[24:0x5def7e0f6f20] <dbl> 
## └─rain_tomorrow=[25:0x5def7e2b2100] <fct>


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0