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:0x5d34de067ae0] <tibble[,24]> 
## ├─Date=[2:0x5d34d95c9fb0] <date> 
## ├─Location=[3:0x5d34d9886b70] <chr> 
## ├─MinTemp=[4:0x5d34de066f30] <dbl> 
## ├─MaxTemp=[5:0x5d34d272a130] <dbl> 
## ├─Rainfall=[6:0x5d34db5da5a0] <dbl> 
## ├─Evaporation=[7:0x5d34db5db150] <dbl> 
## ├─Sunshine=[8:0x5d34db4d8fe0] <dbl> 
## ├─WindGustDir=[9:0x5d34d9887720] <ord> 
## ├─WindGustSpeed=[10:0x5d34db4d9b90] <dbl> 
## ├─WindDir9am=[11:0x5d34d895e540] <ord> 
## ├─WindDir3pm=[12:0x5d34d895eb30] <ord> 
## ├─WindSpeed9am=[13:0x5d34d895f120] <dbl> 
## ├─WindSpeed3pm=[14:0x5d34d902ba20] <dbl> 
## ├─Humidity9am=[15:0x5d34d902c5d0] <int> 
## ├─Humidity3pm=[16:0x5d34d902cbc0] <int> 
## ├─Pressure9am=[17:0x5d34d7d9e640] <dbl> 
## ├─Pressure3pm=[18:0x5d34d7d9f1f0] <dbl> 
## ├─Cloud9am=[19:0x5d34d8344d80] <int> 
## ├─Cloud3pm=[20:0x5d34d8345370] <int> 
## ├─Temp9am=[21:0x5d34d8345960] <dbl> 
## ├─Temp3pm=[22:0x5d34d98c2440] <dbl> 
## ├─RainToday=[23:0x5d34d98c2ff0] <fct> 
## ├─RISK_MM=[24:0x5d34d7d90c60] <dbl> 
## └─RainTomorrow=[25:0x5d34d98c35e0] <fct>
lobstr::ref(ds)
## █ [1:0x5d34dddcc950] <tibble[,24]> 
## ├─date=[2:0x5d34d31d82c0] <date> 
## ├─location=[3:0x5d34d4f35cf0] <chr> 
## ├─min_temp=[4:0x5d34d28b3d50] <dbl> 
## ├─max_temp=[5:0x5d34d424dbf0] <dbl> 
## ├─rainfall=[6:0x5d34d4408dd0] <dbl> 
## ├─evaporation=[7:0x5d34d61fd880] <dbl> 
## ├─sunshine=[8:0x5d34d63b8a60] <dbl> 
## ├─wind_gust_dir=[9:0x5d34d611af70] <ord> 
## ├─wind_gust_speed=[10:0x5d34d5311ac0] <dbl> 
## ├─wind_dir_9am=[11:0x5d34d4d513c0] <ord> 
## ├─wind_dir_3pm=[12:0x5d34d51ce490] <ord> 
## ├─wind_speed_9am=[13:0x5d34d54ccca0] <dbl> 
## ├─wind_speed_3pm=[14:0x5d34d3832550] <dbl> 
## ├─humidity_9am=[15:0x5d34d4e45960] <int> 
## ├─humidity_3pm=[16:0x5d34d2a6ef30] <int> 
## ├─pressure_9am=[17:0x5d34d39ed730] <dbl> 
## ├─pressure_3pm=[18:0x5d34d3ba8910] <dbl> 
## ├─cloud_9am=[19:0x5d34d2e20600] <int> 
## ├─cloud_3pm=[20:0x5d34d5ebead0] <int> 
## ├─temp_9am=[21:0x5d34d461e4b0] <dbl> 
## ├─temp_3pm=[22:0x5d34d47d9690] <dbl> 
## ├─rain_today=[23:0x5d34d4994870] <fct> 
## ├─risk_mm=[24:0x5d34d4a72180] <dbl> 
## └─rain_tomorrow=[25:0x5d34d4c2d360] <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