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:0x608f4f304620] <tibble[,24]> 
## ├─Date=[2:0x608f4d7d4a30] <date> 
## ├─Location=[3:0x608f54e9d510] <chr> 
## ├─MinTemp=[4:0x608f4f303970] <dbl> 
## ├─MaxTemp=[5:0x608f4eb6e7c0] <dbl> 
## ├─Rainfall=[6:0x608f57054190] <dbl> 
## ├─Evaporation=[7:0x608f4eada8f0] <dbl> 
## ├─Sunshine=[8:0x608f443fa750] <dbl> 
## ├─WindGustDir=[9:0x608f504aaed0] <ord> 
## ├─WindGustSpeed=[10:0x608f495ce1f0] <dbl> 
## ├─WindDir9am=[11:0x608f5627b030] <ord> 
## ├─WindDir3pm=[12:0x608f5627b620] <ord> 
## ├─WindSpeed9am=[13:0x608f4f7c5e30] <dbl> 
## ├─WindSpeed3pm=[14:0x608f57743fb0] <dbl> 
## ├─Humidity9am=[15:0x608f4c3114e0] <int> 
## ├─Humidity3pm=[16:0x608f4c311ad0] <int> 
## ├─Pressure9am=[17:0x608f4809f900] <dbl> 
## ├─Pressure3pm=[18:0x608f44a86220] <dbl> 
## ├─Cloud9am=[19:0x608f4db23d20] <int> 
## ├─Cloud3pm=[20:0x608f4db24310] <int> 
## ├─Temp9am=[21:0x608f495c2ab0] <dbl> 
## ├─Temp3pm=[22:0x608f4be88430] <dbl> 
## ├─RainToday=[23:0x608f4f8bd270] <fct> 
## ├─RISK_MM=[24:0x608f4b382fa0] <dbl> 
## └─RainTomorrow=[25:0x608f4f8bd860] <fct>
lobstr::ref(ds)
## █ [1:0x608f58aa4460] <tibble[,24]> 
## ├─date=[2:0x608f505b51d0] <date> 
## ├─location=[3:0x608f4f924560] <chr> 
## ├─min_temp=[4:0x608f51d4dd70] <dbl> 
## ├─max_temp=[5:0x608f51f67c40] <dbl> 
## ├─rainfall=[6:0x608f50c5d1f0] <dbl> 
## ├─evaporation=[7:0x608f50e770c0] <dbl> 
## ├─sunshine=[8:0x608f51090f90] <dbl> 
## ├─wind_gust_dir=[9:0x608f4fb3e430] <ord> 
## ├─wind_gust_speed=[10:0x608f528c8790] <dbl> 
## ├─wind_dir_9am=[11:0x608f512aae60] <ord> 
## ├─wind_dir_3pm=[12:0x608f50955bf0] <ord> 
## ├─wind_speed_9am=[13:0x608f52ae2660] <dbl> 
## ├─wind_speed_3pm=[14:0x608f52cfc530] <dbl> 
## ├─humidity_9am=[15:0x608f52f16400] <int> 
## ├─humidity_3pm=[16:0x608f53023380] <int> 
## ├─pressure_9am=[17:0x608f53130300] <dbl> 
## ├─pressure_3pm=[18:0x608f5334a1d0] <dbl> 
## ├─cloud_9am=[19:0x608f535640a0] <int> 
## ├─cloud_3pm=[20:0x608f53671020] <int> 
## ├─temp_9am=[21:0x608f5377dfa0] <dbl> 
## ├─temp_3pm=[22:0x608f53997e70] <dbl> 
## ├─rain_today=[23:0x608f53bb1d40] <fct> 
## ├─risk_mm=[24:0x608f53cbecc0] <dbl> 
## └─rain_tomorrow=[25:0x608f53ed8b90] <fct>


If you find this curated material useful then you can consider a donation to support it's ongoing availability and give you access to the PDF version of this book. The material has been scoped up by Generative AI without permission or any kind of recompense so do consider a donation if you can afford it. Unlike Generative AI your access to this materials is freely given. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Togaware has a 30 year tradition of making popular open source software which includes sold privacy preserving productivity apps, 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