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:0x60701a0ba0f0] <tibble[,24]> 
## ├─Date=[2:0x607018cd4c70] <date> 
## ├─Location=[3:0x6070173c1eb0] <chr> 
## ├─MinTemp=[4:0x60701a504d50] <dbl> 
## ├─MaxTemp=[5:0x60700d903ba0] <dbl> 
## ├─Rainfall=[6:0x60700ddcdd50] <dbl> 
## ├─Evaporation=[7:0x60700b52f780] <dbl> 
## ├─Sunshine=[8:0x60700cf402e0] <dbl> 
## ├─WindGustDir=[9:0x607017a0fad0] <ord> 
## ├─WindGustSpeed=[10:0x607012983670] <dbl> 
## ├─WindDir9am=[11:0x60700cb9d360] <ord> 
## ├─WindDir3pm=[12:0x60700f262fb0] <ord> 
## ├─WindSpeed9am=[13:0x6070173c4980] <dbl> 
## ├─WindSpeed3pm=[14:0x60700fcc9450] <dbl> 
## ├─Humidity9am=[15:0x60700db691f0] <int> 
## ├─Humidity3pm=[16:0x607012913f60] <int> 
## ├─Pressure9am=[17:0x6070082fd750] <dbl> 
## ├─Pressure3pm=[18:0x60700f226f20] <dbl> 
## ├─Cloud9am=[19:0x607017c893b0] <int> 
## ├─Cloud3pm=[20:0x60700f39b070] <int> 
## ├─Temp9am=[21:0x607010cc4ed0] <dbl> 
## ├─Temp3pm=[22:0x60700fcbf7f0] <dbl> 
## ├─RainToday=[23:0x607017ca4fe0] <fct> 
## ├─RISK_MM=[24:0x60700d2ba220] <dbl> 
## └─RainTomorrow=[25:0x60700f37f6b0] <fct>
lobstr::ref(ds)
## █ [1:0x607019e9e120] <tibble[,24]> 
## ├─date=[2:0x60701347d9c0] <date> 
## ├─location=[3:0x6070125905b0] <chr> 
## ├─min_temp=[4:0x6070129b08c0] <dbl> 
## ├─max_temp=[5:0x607010d7ad50] <dbl> 
## ├─rainfall=[6:0x607010f12100] <dbl> 
## ├─evaporation=[7:0x6070119a17e0] <dbl> 
## ├─sunshine=[8:0x607011b38b90] <dbl> 
## ├─wind_gust_dir=[9:0x6070127ce280] <ord> 
## ├─wind_gust_speed=[10:0x6070136ca7e0] <dbl> 
## ├─wind_dir_9am=[11:0x607011ccff40] <ord> 
## ├─wind_dir_3pm=[12:0x607012cc1150] <ord> 
## ├─wind_speed_9am=[13:0x607013861b90] <dbl> 
## ├─wind_speed_3pm=[14:0x6070139f8f40] <dbl> 
## ├─humidity_9am=[15:0x607013b902f0] <int> 
## ├─humidity_3pm=[16:0x607013c5bcf0] <int> 
## ├─pressure_9am=[17:0x607013d276f0] <dbl> 
## ├─pressure_3pm=[18:0x607013ebeaa0] <dbl> 
## ├─cloud_9am=[19:0x607014055e50] <int> 
## ├─cloud_3pm=[20:0x607014121850] <int> 
## ├─temp_9am=[21:0x6070141ed250] <dbl> 
## ├─temp_3pm=[22:0x607014384600] <dbl> 
## ├─rain_today=[23:0x60701451b9b0] <fct> 
## ├─risk_mm=[24:0x6070145e73b0] <dbl> 
## └─rain_tomorrow=[25:0x60701477e760] <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