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:0x565235f115e0] <tibble[,24]> 
## ├─Date=[2:0x56524605f200] <date> 
## ├─Location=[3:0x565245ebf750] <chr> 
## ├─MinTemp=[4:0x5652457f8850] <dbl> 
## ├─MaxTemp=[5:0x565247881630] <dbl> 
## ├─Rainfall=[6:0x56523f0587b0] <dbl> 
## ├─Evaporation=[7:0x56523a6f6860] <dbl> 
## ├─Sunshine=[8:0x56523d079350] <dbl> 
## ├─WindGustDir=[9:0x565243e31310] <ord> 
## ├─WindGustSpeed=[10:0x565248d3cd10] <dbl> 
## ├─WindDir9am=[11:0x56523942ec20] <ord> 
## ├─WindDir3pm=[12:0x56523942f210] <ord> 
## ├─WindSpeed9am=[13:0x56523970be10] <dbl> 
## ├─WindSpeed3pm=[14:0x56523bbea5e0] <dbl> 
## ├─Humidity9am=[15:0x565248bb2500] <int> 
## ├─Humidity3pm=[16:0x565248bb2af0] <int> 
## ├─Pressure9am=[17:0x56523a683b70] <dbl> 
## ├─Pressure3pm=[18:0x56523927f860] <dbl> 
## ├─Cloud9am=[19:0x56523f41d880] <int> 
## ├─Cloud3pm=[20:0x56523f41de70] <int> 
## ├─Temp9am=[21:0x56523fd24fc0] <dbl> 
## ├─Temp3pm=[22:0x56523d8f7530] <dbl> 
## ├─RainToday=[23:0x565240378730] <fct> 
## ├─RISK_MM=[24:0x565248273fb0] <dbl> 
## └─RainTomorrow=[25:0x565240378d20] <fct>
lobstr::ref(ds)
## █ [1:0x565243e42a50] <tibble[,24]> 
## ├─date=[2:0x565240f63530] <date> 
## ├─location=[3:0x565243386fa0] <chr> 
## ├─min_temp=[4:0x5652435a0e70] <dbl> 
## ├─max_temp=[5:0x5652422c3370] <dbl> 
## ├─rainfall=[6:0x5652424dd240] <dbl> 
## ├─evaporation=[7:0x5652426f7110] <dbl> 
## ├─sunshine=[8:0x56524164a810] <dbl> 
## ├─wind_gust_dir=[9:0x56524117d400] <ord> 
## ├─wind_gust_speed=[10:0x5652418646e0] <dbl> 
## ├─wind_dir_9am=[11:0x565242910fe0] <ord> 
## ├─wind_dir_3pm=[12:0x565241fbd9a0] <ord> 
## ├─wind_speed_9am=[13:0x565241a7e5b0] <dbl> 
## ├─wind_speed_3pm=[14:0x565241c98480] <dbl> 
## ├─humidity_9am=[15:0x56524451f1d0] <int> 
## ├─humidity_3pm=[16:0x56524462c150] <int> 
## ├─pressure_9am=[17:0x5652447390d0] <dbl> 
## ├─pressure_3pm=[18:0x565244952fa0] <dbl> 
## ├─cloud_9am=[19:0x565244b6ce70] <int> 
## ├─cloud_3pm=[20:0x565244c79df0] <int> 
## ├─temp_9am=[21:0x565244d86d70] <dbl> 
## ├─temp_3pm=[22:0x565244fa0c40] <dbl> 
## ├─rain_today=[23:0x5652451bab10] <fct> 
## ├─risk_mm=[24:0x5652452c7a90] <dbl> 
## └─rain_tomorrow=[25:0x5652454e1960] <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