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:0x57cbc1b0d5a0] <tibble[,24]> 
## ├─Date=[2:0x57cbbbf59f60] <date> 
## ├─Location=[3:0x57cbb17b28d0] <chr> 
## ├─MinTemp=[4:0x57cbc1b0c9f0] <dbl> 
## ├─MaxTemp=[5:0x57cbbcf89380] <dbl> 
## ├─Rainfall=[6:0x57cbba9f5350] <dbl> 
## ├─Evaporation=[7:0x57cbbbfd9da0] <dbl> 
## ├─Sunshine=[8:0x57cbb3e42840] <dbl> 
## ├─WindGustDir=[9:0x57cbb6e82d20] <ord> 
## ├─WindGustSpeed=[10:0x57cbb4746ef0] <dbl> 
## ├─WindDir9am=[11:0x57cbb70e5f00] <ord> 
## ├─WindDir3pm=[12:0x57cbb4f0f1e0] <ord> 
## ├─WindSpeed9am=[13:0x57cbb4ca15a0] <dbl> 
## ├─WindSpeed3pm=[14:0x57cbba0b3720] <dbl> 
## ├─Humidity9am=[15:0x57cbb55f15f0] <int> 
## ├─Humidity3pm=[16:0x57cbb4a64bf0] <int> 
## ├─Pressure9am=[17:0x57cbb81e5930] <dbl> 
## ├─Pressure3pm=[18:0x57cbb474ec40] <dbl> 
## ├─Cloud9am=[19:0x57cbaf48b8a0] <int> 
## ├─Cloud3pm=[20:0x57cbb4ff03d0] <int> 
## ├─Temp9am=[21:0x57cbb8dba3f0] <dbl> 
## ├─Temp3pm=[22:0x57cbbe766660] <dbl> 
## ├─RainToday=[23:0x57cbb5004110] <fct> 
## ├─RISK_MM=[24:0x57cbbf60a2a0] <dbl> 
## └─RainTomorrow=[25:0x57cbba7645e0] <fct>
lobstr::ref(ds)
## █ [1:0x57cbb4b21650] <tibble[,24]> 
## ├─date=[2:0x57cbb82a4ff0] <date> 
## ├─location=[3:0x57cbb9beb850] <chr> 
## ├─min_temp=[4:0x57cbb9d82c00] <dbl> 
## ├─max_temp=[5:0x57cbba36c890] <dbl> 
## ├─rainfall=[6:0x57cbba503c40] <dbl> 
## ├─evaporation=[7:0x57cbb8dbb340] <dbl> 
## ├─sunshine=[8:0x57cbb8f526f0] <dbl> 
## ├─wind_gust_dir=[9:0x57cbba16a2a0] <ord> 
## ├─wind_gust_speed=[10:0x57cbb90e9aa0] <dbl> 
## ├─wind_dir_9am=[11:0x57cbb9a82980] <ord> 
## ├─wind_dir_3pm=[12:0x57cbba265ab0] <ord> 
## ├─wind_speed_9am=[13:0x57cbb9280e50] <dbl> 
## ├─wind_speed_3pm=[14:0x57cbb9418200] <dbl> 
## ├─humidity_9am=[15:0x57cbb843c3a0] <int> 
## ├─humidity_3pm=[16:0x57cbb95af5b0] <int> 
## ├─pressure_9am=[17:0x57cbb967afb0] <dbl> 
## ├─pressure_3pm=[18:0x57cbb9812360] <dbl> 
## ├─cloud_9am=[19:0x57cbb99a9710] <int> 
## ├─cloud_3pm=[20:0x57cbbb1d0530] <int> 
## ├─temp_9am=[21:0x57cbbb29bf30] <dbl> 
## ├─temp_3pm=[22:0x57cbbb4332e0] <dbl> 
## ├─rain_today=[23:0x57cbbb5ca690] <fct> 
## ├─risk_mm=[24:0x57cbbb696090] <dbl> 
## └─rain_tomorrow=[25:0x57cbbb82d440] <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