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:0x609051af2bc0] <tibble[,24]> 
## ├─Date=[2:0x609040bb1c40] <date> 
## ├─Location=[3:0x60904c0105e0] <chr> 
## ├─MinTemp=[4:0x609053f16540] <dbl> 
## ├─MaxTemp=[5:0x609048b1c790] <dbl> 
## ├─Rainfall=[6:0x60904dc5d420] <dbl> 
## ├─Evaporation=[7:0x60904e5ba190] <dbl> 
## ├─Sunshine=[8:0x60904c0b4310] <dbl> 
## ├─WindGustDir=[9:0x60904cbf31f0] <ord> 
## ├─WindGustSpeed=[10:0x609048ccf940] <dbl> 
## ├─WindDir9am=[11:0x609045e43120] <ord> 
## ├─WindDir3pm=[12:0x60904c2f19d0] <ord> 
## ├─WindSpeed9am=[13:0x60904dcf3910] <dbl> 
## ├─WindSpeed3pm=[14:0x60904aa9ca10] <dbl> 
## ├─Humidity9am=[15:0x60904d4b3f70] <int> 
## ├─Humidity3pm=[16:0x60904d808bc0] <int> 
## ├─Pressure9am=[17:0x60904bdc8430] <dbl> 
## ├─Pressure3pm=[18:0x609047406d40] <dbl> 
## ├─Cloud9am=[19:0x60904c7b1a70] <int> 
## ├─Cloud3pm=[20:0x60904d60ec30] <int> 
## ├─Temp9am=[21:0x60904c5918a0] <dbl> 
## ├─Temp3pm=[22:0x609045f9a3a0] <dbl> 
## ├─RainToday=[23:0x60904ecafd60] <fct> 
## ├─RISK_MM=[24:0x60904b64b6e0] <dbl> 
## └─RainTomorrow=[25:0x60904d0dfd00] <fct>
lobstr::ref(ds)
## █ [1:0x60904f145ec0] <tibble[,24]> 
## ├─date=[2:0x609048354920] <date> 
## ├─location=[3:0x609047630e80] <chr> 
## ├─min_temp=[4:0x609047ec01e0] <dbl> 
## ├─max_temp=[5:0x60904a6ecde0] <dbl> 
## ├─rainfall=[6:0x60904a8a7fc0] <dbl> 
## ├─evaporation=[7:0x609048589c20] <dbl> 
## ├─sunshine=[8:0x609048744e00] <dbl> 
## ├─wind_gust_dir=[9:0x6090477ec060] <ord> 
## ├─wind_gust_speed=[10:0x6090488fffe0] <dbl> 
## ├─wind_dir_9am=[11:0x609047cc4920] <ord> 
## ├─wind_dir_3pm=[12:0x60904807b3c0] <ord> 
## ├─wind_speed_9am=[13:0x609048cef1b0] <dbl> 
## ├─wind_speed_3pm=[14:0x609048eaa390] <dbl> 
## ├─humidity_9am=[15:0x60904a32b7f0] <int> 
## ├─humidity_3pm=[16:0x609049065570] <int> 
## ├─pressure_9am=[17:0x609049142e80] <dbl> 
## ├─pressure_3pm=[18:0x6090492fe060] <dbl> 
## ├─cloud_9am=[19:0x6090494b9240] <int> 
## ├─cloud_3pm=[20:0x609049596b50] <int> 
## ├─temp_9am=[21:0x609049674460] <dbl> 
## ├─temp_3pm=[22:0x60904982f640] <dbl> 
## ├─rain_today=[23:0x6090499ea820] <fct> 
## ├─risk_mm=[24:0x60904b471f60] <dbl> 
## └─rain_tomorrow=[25:0x609049ac8130] <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