10.29 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:0x55a97d8321f0] <tibble[,24]> 
## ├─Date=[2:0x55a96a4032f0] <date> 
## ├─Location=[3:0x55a976de0330] <chr> 
## ├─MinTemp=[4:0x55a97dcee3f0] <dbl> 
## ├─MaxTemp=[5:0x55a975634b40] <dbl> 
## ├─Rainfall=[6:0x55a9755e08d0] <dbl> 
## ├─Evaporation=[7:0x55a977203b80] <dbl> 
## ├─Sunshine=[8:0x55a976cf6d90] <dbl> 
## ├─WindGustDir=[9:0x55a977973f40] <ord> 
## ├─WindGustSpeed=[10:0x55a973026e70] <dbl> 
## ├─WindDir9am=[11:0x55a976de0ee0] <ord> 
## ├─WindDir3pm=[12:0x55a9756356f0] <ord> 
## ├─WindSpeed9am=[13:0x55a9758c0580] <dbl> 
## ├─WindSpeed3pm=[14:0x55a977047530] <dbl> 
## ├─Humidity9am=[15:0x55a977204730] <int> 
## ├─Humidity3pm=[16:0x55a976cf7940] <int> 
## ├─Pressure9am=[17:0x55a975cae120] <dbl> 
## ├─Pressure3pm=[18:0x55a972b60410] <dbl> 
## ├─Cloud9am=[19:0x55a9755e1480] <int> 
## ├─Cloud3pm=[20:0x55a9758c1130] <int> 
## ├─Temp9am=[21:0x55a97183d8f0] <dbl> 
## ├─Temp3pm=[22:0x55a97cef4d80] <dbl> 
## ├─RainToday=[23:0x55a9770480e0] <fct> 
## ├─RISK_MM=[24:0x55a976233ba0] <dbl> 
## └─RainTomorrow=[25:0x55a973027a20] <fct>
lobstr::ref(ds)
## █ [1:0x55a977847900] <tibble[,24]> 
## ├─date=[2:0x55a97299b850] <date> 
## ├─location=[3:0x55a970966350] <chr> 
## ├─min_temp=[4:0x55a9730c9310] <dbl> 
## ├─max_temp=[5:0x55a972ccf2d0] <dbl> 
## ├─rainfall=[6:0x55a973460110] <dbl> 
## ├─evaporation=[7:0x55a97361b2f0] <dbl> 
## ├─sunshine=[8:0x55a97115c9c0] <dbl> 
## ├─wind_gust_dir=[9:0x55a973323430] <ord> 
## ├─wind_gust_speed=[10:0x55a971317ba0] <dbl> 
## ├─wind_dir_9am=[11:0x55a972b6de40] <ord> 
## ├─wind_dir_3pm=[12:0x55a9716402b0] <ord> 
## ├─wind_speed_9am=[13:0x55a974380710] <dbl> 
## ├─wind_speed_3pm=[14:0x55a97453b8f0] <dbl> 
## ├─humidity_9am=[15:0x55a972e8a4b0] <int> 
## ├─humidity_3pm=[16:0x55a9746f6ad0] <int> 
## ├─pressure_9am=[17:0x55a9747d43e0] <dbl> 
## ├─pressure_3pm=[18:0x55a97498f5c0] <dbl> 
## ├─cloud_9am=[19:0x55a974b4a7a0] <int> 
## ├─cloud_3pm=[20:0x55a974c280b0] <int> 
## ├─temp_9am=[21:0x55a974d059c0] <dbl> 
## ├─temp_3pm=[22:0x55a974ec0ba0] <dbl> 
## ├─rain_today=[23:0x55a97507bd80] <fct> 
## ├─risk_mm=[24:0x55a975159690] <dbl> 
## └─rain_tomorrow=[25:0x55a975314870] <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