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:0x5f38792dafd0] <tibble[,24]> 
## ├─Date=[2:0x5f3873ba53e0] <date> 
## ├─Location=[3:0x5f3873f29540] <chr> 
## ├─MinTemp=[4:0x5f387ac5c400] <dbl> 
## ├─MaxTemp=[5:0x5f387488eb70] <dbl> 
## ├─Rainfall=[6:0x5f3871d19f50] <dbl> 
## ├─Evaporation=[7:0x5f3871df2440] <dbl> 
## ├─Sunshine=[8:0x5f387565fad0] <dbl> 
## ├─WindGustDir=[9:0x5f386f4e4830] <ord> 
## ├─WindGustSpeed=[10:0x5f386b3990f0] <dbl> 
## ├─WindDir9am=[11:0x5f387519bae0] <ord> 
## ├─WindDir3pm=[12:0x5f3875b79370] <ord> 
## ├─WindSpeed9am=[13:0x5f3873c2dff0] <dbl> 
## ├─WindSpeed3pm=[14:0x5f387430b6f0] <dbl> 
## ├─Humidity9am=[15:0x5f38761c4760] <int> 
## ├─Humidity3pm=[16:0x5f386c2521e0] <int> 
## ├─Pressure9am=[17:0x5f3873af7f40] <dbl> 
## ├─Pressure3pm=[18:0x5f3873162570] <dbl> 
## ├─Cloud9am=[19:0x5f3875b6ec00] <int> 
## ├─Cloud3pm=[20:0x5f38744dd900] <int> 
## ├─Temp9am=[21:0x5f386fc83260] <dbl> 
## ├─Temp3pm=[22:0x5f386f2188d0] <dbl> 
## ├─RainToday=[23:0x5f3876d38a00] <fct> 
## ├─RISK_MM=[24:0x5f3874607040] <dbl> 
## └─RainTomorrow=[25:0x5f38767e3160] <fct>
lobstr::ref(ds)
## █ [1:0x5f387b67add0] <tibble[,24]> 
## ├─date=[2:0x5f3870fe52f0] <date> 
## ├─location=[3:0x5f386e7c0d10] <chr> 
## ├─min_temp=[4:0x5f3870a539e0] <dbl> 
## ├─max_temp=[5:0x5f387133e8f0] <dbl> 
## ├─rainfall=[6:0x5f38714f9ad0] <dbl> 
## ├─evaporation=[7:0x5f386f62c8e0] <dbl> 
## ├─sunshine=[8:0x5f386f7e7ac0] <dbl> 
## ├─wind_gust_dir=[9:0x5f386e97bef0] <ord> 
## ├─wind_gust_speed=[10:0x5f386f9a2ca0] <dbl> 
## ├─wind_dir_9am=[11:0x5f386fb5de80] <ord> 
## ├─wind_dir_3pm=[12:0x5f38716b4cb0] <ord> 
## ├─wind_speed_9am=[13:0x5f3871f9f730] <dbl> 
## ├─wind_speed_3pm=[14:0x5f387215a910] <dbl> 
## ├─humidity_9am=[15:0x5f386ebc4510] <int> 
## ├─humidity_3pm=[16:0x5f386f019c40] <int> 
## ├─pressure_9am=[17:0x5f3872315af0] <dbl> 
## ├─pressure_3pm=[18:0x5f38700dae30] <dbl> 
## ├─cloud_9am=[19:0x5f3870c0ebc0] <int> 
## ├─cloud_3pm=[20:0x5f38724d0cd0] <int> 
## ├─temp_9am=[21:0x5f3870296010] <dbl> 
## ├─temp_3pm=[22:0x5f38704511f0] <dbl> 
## ├─rain_today=[23:0x5f387060c3d0] <fct> 
## ├─risk_mm=[24:0x5f38706e9ce0] <dbl> 
## └─rain_tomorrow=[25:0x5f38708a4ec0] <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