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:0x61bfb8116690] <tibble[,24]> 
## ├─Date=[2:0x61bfacf663e0] <date> 
## ├─Location=[3:0x61bfa371fe60] <chr> 
## ├─MinTemp=[4:0x61bfb8115ae0] <dbl> 
## ├─MaxTemp=[5:0x61bfaffdd490] <dbl> 
## ├─Rainfall=[6:0x61bfb1080bf0] <dbl> 
## ├─Evaporation=[7:0x61bfb0cbf260] <dbl> 
## ├─Sunshine=[8:0x61bfaa7ab3b0] <dbl> 
## ├─WindGustDir=[9:0x61bfa8906060] <ord> 
## ├─WindGustSpeed=[10:0x61bfb10b9940] <dbl> 
## ├─WindDir9am=[11:0x61bfb1047160] <ord> 
## ├─WindDir3pm=[12:0x61bfaa9c52f0] <ord> 
## ├─WindSpeed9am=[13:0x61bfb25eec80] <dbl> 
## ├─WindSpeed3pm=[14:0x61bfb0227a30] <dbl> 
## ├─Humidity9am=[15:0x61bfacb8a410] <int> 
## ├─Humidity3pm=[16:0x61bfb14c9260] <int> 
## ├─Pressure9am=[17:0x61bfa6e3c220] <dbl> 
## ├─Pressure3pm=[18:0x61bfb0e04650] <dbl> 
## ├─Cloud9am=[19:0x61bfb103b730] <int> 
## ├─Cloud3pm=[20:0x61bfb0578be0] <int> 
## ├─Temp9am=[21:0x61bfa6d4fa40] <dbl> 
## ├─Temp3pm=[22:0x61bfab28e6f0] <dbl> 
## ├─RainToday=[23:0x61bfad6db380] <fct> 
## ├─RISK_MM=[24:0x61bfaf0ab4e0] <dbl> 
## └─RainTomorrow=[25:0x61bfab6178a0] <fct>
lobstr::ref(ds)
## █ [1:0x61bfb331b100] <tibble[,24]> 
## ├─date=[2:0x61bfac8a4c70] <date> 
## ├─location=[3:0x61bfaa4dc390] <chr> 
## ├─min_temp=[4:0x61bfaccb7c90] <dbl> 
## ├─max_temp=[5:0x61bfad109fb0] <dbl> 
## ├─rainfall=[6:0x61bfad2c5190] <dbl> 
## ├─evaporation=[7:0x61bfabe25fc0] <dbl> 
## ├─sunshine=[8:0x61bfabfe11a0] <dbl> 
## ├─wind_gust_dir=[9:0x61bfaca5fe50] <ord> 
## ├─wind_gust_speed=[10:0x61bfac19c380] <dbl> 
## ├─wind_dir_9am=[11:0x61bfaa697570] <ord> 
## ├─wind_dir_3pm=[12:0x61bfad480370] <ord> 
## ├─wind_speed_9am=[13:0x61bfade523e0] <dbl> 
## ├─wind_speed_3pm=[14:0x61bfae00d5c0] <dbl> 
## ├─humidity_9am=[15:0x61bfab84c350] <int> 
## ├─humidity_3pm=[16:0x61bface72e70] <int> 
## ├─pressure_9am=[17:0x61bfae1c87a0] <dbl> 
## ├─pressure_3pm=[18:0x61bfae383980] <dbl> 
## ├─cloud_9am=[19:0x61bfaad07a90] <int> 
## ├─cloud_3pm=[20:0x61bfae53eb60] <int> 
## ├─temp_9am=[21:0x61bfae61c470] <dbl> 
## ├─temp_3pm=[22:0x61bfae7d7650] <dbl> 
## ├─rain_today=[23:0x61bfae992830] <fct> 
## ├─risk_mm=[24:0x61bfaea70140] <dbl> 
## └─rain_tomorrow=[25:0x61bfaec2b320] <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