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:0x6117da8a7930] <tibble[,24]> 
## ├─Date=[2:0x6117d1b2aed0] <date> 
## ├─Location=[3:0x6117d1b2ba80] <chr> 
## ├─MinTemp=[4:0x6117dc833c60] <dbl> 
## ├─MaxTemp=[5:0x6117d7b55030] <dbl> 
## ├─Rainfall=[6:0x6117d1a5ce70] <dbl> 
## ├─Evaporation=[7:0x6117d1a5da20] <dbl> 
## ├─Sunshine=[8:0x6117d67e0a40] <dbl> 
## ├─WindGustDir=[9:0x6117d67e15f0] <ord> 
## ├─WindGustSpeed=[10:0x6117d590b920] <dbl> 
## ├─WindDir9am=[11:0x6117d67e1be0] <ord> 
## ├─WindDir3pm=[12:0x6117d590c4d0] <ord> 
## ├─WindSpeed9am=[13:0x6117d49458c0] <dbl> 
## ├─WindSpeed3pm=[14:0x6117d4946470] <dbl> 
## ├─Humidity9am=[15:0x6117d590cac0] <int> 
## ├─Humidity3pm=[16:0x6117d7919bd0] <int> 
## ├─Pressure9am=[17:0x6117d791a1c0] <dbl> 
## ├─Pressure3pm=[18:0x6117d6427fe0] <dbl> 
## ├─Cloud9am=[19:0x6117d791ad70] <int> 
## ├─Cloud3pm=[20:0x6117d6428b90] <int> 
## ├─Temp9am=[21:0x6117d7b7e280] <dbl> 
## ├─Temp3pm=[22:0x6117d7b7ee30] <dbl> 
## ├─RainToday=[23:0x6117d6429180] <fct> 
## ├─RISK_MM=[24:0x6117d637eff0] <dbl> 
## └─RainTomorrow=[25:0x6117d637fba0] <fct>
lobstr::ref(ds)
## █ [1:0x6117dabf9a30] <tibble[,24]> 
## ├─date=[2:0x6117d1f391f0] <date> 
## ├─location=[3:0x6117d23a2840] <chr> 
## ├─min_temp=[4:0x6117cfac4660] <dbl> 
## ├─max_temp=[5:0x6117d2768600] <dbl> 
## ├─rainfall=[6:0x6117d29237e0] <dbl> 
## ├─evaporation=[7:0x6117d1507120] <dbl> 
## ├─sunshine=[8:0x6117d16c2300] <dbl> 
## ├─wind_gust_dir=[9:0x6117d21b32c0] <ord> 
## ├─wind_gust_speed=[10:0x6117d187d4e0] <dbl> 
## ├─wind_dir_9am=[11:0x6117d26320c0] <ord> 
## ├─wind_dir_3pm=[12:0x6117cfc7f840] <ord> 
## ├─wind_speed_9am=[13:0x6117d3391990] <dbl> 
## ├─wind_speed_3pm=[14:0x6117d354cb70] <dbl> 
## ├─humidity_9am=[15:0x6117d2ade9c0] <int> 
## ├─humidity_3pm=[16:0x6117d0ef3040] <int> 
## ├─pressure_9am=[17:0x6117d3707d50] <dbl> 
## ├─pressure_3pm=[18:0x6117d38c2f30] <dbl> 
## ├─cloud_9am=[19:0x6117d0446110] <int> 
## ├─cloud_3pm=[20:0x6117d3a7e110] <int> 
## ├─temp_9am=[21:0x6117d3b5ba20] <dbl> 
## ├─temp_3pm=[22:0x6117d3d16c00] <dbl> 
## ├─rain_today=[23:0x6117d3ed1de0] <fct> 
## ├─risk_mm=[24:0x6117d3faf6f0] <dbl> 
## └─rain_tomorrow=[25:0x6117d416a8d0] <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