10.28 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:0x5cd0f6040f90] <tibble[,24]> 
## ├─Date=[2:0x5cd0ed544530] <date> 
## ├─Location=[3:0x5cd0f3671980] <chr> 
## ├─MinTemp=[4:0x5cd0ed7d4090] <dbl> 
## ├─MaxTemp=[5:0x5cd0f7378730] <dbl> 
## ├─Rainfall=[6:0x5cd0f04dd080] <dbl> 
## ├─Evaporation=[7:0x5cd0f75249f0] <dbl> 
## ├─Sunshine=[8:0x5cd0ed5e4db0] <dbl> 
## ├─WindGustDir=[9:0x5cd0ed68f050] <ord> 
## ├─WindGustSpeed=[10:0x5cd0ef42f280] <dbl> 
## ├─WindDir9am=[11:0x5cd0f0167310] <ord> 
## ├─WindDir3pm=[12:0x5cd0f30984b0] <ord> 
## ├─WindSpeed9am=[13:0x5cd0ed4579e0] <dbl> 
## ├─WindSpeed3pm=[14:0x5cd0ed1e91c0] <dbl> 
## ├─Humidity9am=[15:0x5cd0efe59060] <int> 
## ├─Humidity3pm=[16:0x5cd0ec183870] <int> 
## ├─Pressure9am=[17:0x5cd0ed6187b0] <dbl> 
## ├─Pressure3pm=[18:0x5cd0f085a550] <dbl> 
## ├─Cloud9am=[19:0x5cd0e94eec80] <int> 
## ├─Cloud3pm=[20:0x5cd0ebfc3fc0] <int> 
## ├─Temp9am=[21:0x5cd0ed5e5fe0] <dbl> 
## ├─Temp3pm=[22:0x5cd0ec573fc0] <dbl> 
## ├─RainToday=[23:0x5cd0f0383680] <fct> 
## ├─RISK_MM=[24:0x5cd0ed9274d0] <dbl> 
## └─RainTomorrow=[25:0x5cd0e90e3710] <fct>
lobstr::ref(ds)
## █ [1:0x5cd0ed953de0] <tibble[,24]> 
## ├─date=[2:0x5cd0edcff750] <date> 
## ├─location=[3:0x5cd0f10690b0] <chr> 
## ├─min_temp=[4:0x5cd0f1224290] <dbl> 
## ├─max_temp=[5:0x5cd0f13df470] <dbl> 
## ├─rainfall=[6:0x5cd0eea71a80] <dbl> 
## ├─evaporation=[7:0x5cd0eec2cc60] <dbl> 
## ├─sunshine=[8:0x5cd0eede7e40] <dbl> 
## ├─wind_gust_dir=[9:0x5cd0f159a650] <ord> 
## ├─wind_gust_speed=[10:0x5cd0eefa3020] <dbl> 
## ├─wind_dir_9am=[11:0x5cd0ef15e200] <ord> 
## ├─wind_dir_3pm=[12:0x5cd0ef23bb10] <ord> 
## ├─wind_speed_9am=[13:0x5cd0f1dc46c0] <dbl> 
## ├─wind_speed_3pm=[14:0x5cd0f1f7f8a0] <dbl> 
## ├─humidity_9am=[15:0x5cd0ef319420] <int> 
## ├─humidity_3pm=[16:0x5cd0f213aa80] <int> 
## ├─pressure_9am=[17:0x5cd0f2218390] <dbl> 
## ├─pressure_3pm=[18:0x5cd0f23d3570] <dbl> 
## ├─cloud_9am=[19:0x5cd0f258e750] <int> 
## ├─cloud_3pm=[20:0x5cd0f266c060] <int> 
## ├─temp_9am=[21:0x5cd0f2749970] <dbl> 
## ├─temp_3pm=[22:0x5cd0f2904b50] <dbl> 
## ├─rain_today=[23:0x5cd0f2abfd30] <fct> 
## ├─risk_mm=[24:0x5cd0f2b9d640] <dbl> 
## └─rain_tomorrow=[25:0x5cd0f2d58820] <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