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:0x556fa2463f30] <tibble[,24]> 
## ├─Date=[2:0x556f97be2820] <date> 
## ├─Location=[3:0x556f9796f4a0] <chr> 
## ├─MinTemp=[4:0x556f9aec4420] <dbl> 
## ├─MaxTemp=[5:0x556f9ba0ed90] <dbl> 
## ├─Rainfall=[6:0x556f91650590] <dbl> 
## ├─Evaporation=[7:0x556f957485c0] <dbl> 
## ├─Sunshine=[8:0x556f92122d80] <dbl> 
## ├─WindGustDir=[9:0x556f9d258810] <ord> 
## ├─WindGustSpeed=[10:0x556f97c74780] <dbl> 
## ├─WindDir9am=[11:0x556f950471c0] <ord> 
## ├─WindDir3pm=[12:0x556f950477b0] <ord> 
## ├─WindSpeed9am=[13:0x556f96759760] <dbl> 
## ├─WindSpeed3pm=[14:0x556f99bb0a40] <dbl> 
## ├─Humidity9am=[15:0x556f9add95b0] <int> 
## ├─Humidity3pm=[16:0x556f9add9ba0] <int> 
## ├─Pressure9am=[17:0x556f9503acf0] <dbl> 
## ├─Pressure3pm=[18:0x556f9ade5040] <dbl> 
## ├─Cloud9am=[19:0x556f97423af0] <int> 
## ├─Cloud3pm=[20:0x556f974240e0] <int> 
## ├─Temp9am=[21:0x556f9c59b910] <dbl> 
## ├─Temp3pm=[22:0x556f92813470] <dbl> 
## ├─RainToday=[23:0x556f97bfb010] <fct> 
## ├─RISK_MM=[24:0x556f983ddbb0] <dbl> 
## └─RainTomorrow=[25:0x556f97bfb600] <fct>
lobstr::ref(ds)
## █ [1:0x556f9f446210] <tibble[,24]> 
## ├─date=[2:0x556f96266a30] <date> 
## ├─location=[3:0x556f959aba30] <chr> 
## ├─min_temp=[4:0x556f96ea72a0] <dbl> 
## ├─max_temp=[5:0x556f98a52ce0] <dbl> 
## ├─rainfall=[6:0x556f98c0dec0] <dbl> 
## ├─evaporation=[7:0x556f98dc90a0] <dbl> 
## ├─sunshine=[8:0x556f98f84280] <dbl> 
## ├─wind_gust_dir=[9:0x556f97062480] <ord> 
## ├─wind_gust_speed=[10:0x556f9913f460] <dbl> 
## ├─wind_dir_9am=[11:0x556f992fa640] <ord> 
## ├─wind_dir_3pm=[12:0x556f993d7f50] <ord> 
## ├─wind_speed_9am=[13:0x556f99d3d1a0] <dbl> 
## ├─wind_speed_3pm=[14:0x556f99ef8380] <dbl> 
## ├─humidity_9am=[15:0x556f994b5860] <int> 
## ├─humidity_3pm=[16:0x556f9a0b3560] <int> 
## ├─pressure_9am=[17:0x556f9a190e70] <dbl> 
## ├─pressure_3pm=[18:0x556f9a34c050] <dbl> 
## ├─cloud_9am=[19:0x556f9a507230] <int> 
## ├─cloud_3pm=[20:0x556f9a5e4b40] <int> 
## ├─temp_9am=[21:0x556f9a6c2450] <dbl> 
## ├─temp_3pm=[22:0x556f9a87d630] <dbl> 
## ├─rain_today=[23:0x556f9aa38810] <fct> 
## ├─risk_mm=[24:0x556f9ab16120] <dbl> 
## └─rain_tomorrow=[25:0x556f9acd1300] <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