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:0x5dd8fedafef0] <tibble[,24]> 
## ├─Date=[2:0x5dd8f3ba3ba0] <date> 
## ├─Location=[3:0x5dd8f6366ba0] <chr> 
## ├─MinTemp=[4:0x5dd8fdbd3300] <dbl> 
## ├─MaxTemp=[5:0x5dd8f66330c0] <dbl> 
## ├─Rainfall=[6:0x5dd8fa607b60] <dbl> 
## ├─Evaporation=[7:0x5dd8fa850d90] <dbl> 
## ├─Sunshine=[8:0x5dd8f6d11420] <dbl> 
## ├─WindGustDir=[9:0x5dd8f3ba4750] <ord> 
## ├─WindGustSpeed=[10:0x5dd8fab0b6e0] <dbl> 
## ├─WindDir9am=[11:0x5dd8f6367750] <ord> 
## ├─WindDir3pm=[12:0x5dd8fa24db90] <ord> 
## ├─WindSpeed9am=[13:0x5dd8fa60c8e0] <dbl> 
## ├─WindSpeed3pm=[14:0x5dd8fa7d08e0] <dbl> 
## ├─Humidity9am=[15:0x5dd8f6633c70] <int> 
## ├─Humidity3pm=[16:0x5dd8fa851940] <int> 
## ├─Pressure9am=[17:0x5dd8f8df0730] <dbl> 
## ├─Pressure3pm=[18:0x5dd8fa150670] <dbl> 
## ├─Cloud9am=[19:0x5dd8f6d11fd0] <int> 
## ├─Cloud3pm=[20:0x5dd8fa608710] <int> 
## ├─Temp9am=[21:0x5dd8f4687270] <dbl> 
## ├─Temp3pm=[22:0x5dd8f6590980] <dbl> 
## ├─RainToday=[23:0x5dd8fab0c290] <fct> 
## ├─RISK_MM=[24:0x5dd8fa856df0] <dbl> 
## └─RainTomorrow=[25:0x5dd8fa7d1490] <fct>
lobstr::ref(ds)
## █ [1:0x5dd8fab120e0] <tibble[,24]> 
## ├─date=[2:0x5dd8f5f27290] <date> 
## ├─location=[3:0x5dd8f6397e90] <chr> 
## ├─min_temp=[4:0x5dd8f3c68a90] <dbl> 
## ├─max_temp=[5:0x5dd8f671a790] <dbl> 
## ├─rainfall=[6:0x5dd8f68d5970] <dbl> 
## ├─evaporation=[7:0x5dd8f55261d0] <dbl> 
## ├─sunshine=[8:0x5dd8f56e13b0] <dbl> 
## ├─wind_gust_dir=[9:0x5dd8f61956f0] <ord> 
## ├─wind_gust_speed=[10:0x5dd8f4a91670] <dbl> 
## ├─wind_dir_9am=[11:0x5dd8f3e23c70] <ord> 
## ├─wind_dir_3pm=[12:0x5dd8f403bb00] <ord> 
## ├─wind_speed_9am=[13:0x5dd8f4c4c850] <dbl> 
## ├─wind_speed_3pm=[14:0x5dd8f4e07a30] <dbl> 
## ├─humidity_9am=[15:0x5dd8f4fc2c10] <int> 
## ├─humidity_3pm=[16:0x5dd8f6a90b50] <int> 
## ├─pressure_9am=[17:0x5dd8f736a130] <dbl> 
## ├─pressure_3pm=[18:0x5dd8f7525310] <dbl> 
## ├─cloud_9am=[19:0x5dd8f43c41e0] <int> 
## ├─cloud_3pm=[20:0x5dd8f589c590] <int> 
## ├─temp_9am=[21:0x5dd8f76e04f0] <dbl> 
## ├─temp_3pm=[22:0x5dd8f7e9ce90] <dbl> 
## ├─rain_today=[23:0x5dd8f789b6d0] <fct> 
## ├─risk_mm=[24:0x5dd8f8058070] <dbl> 
## └─rain_tomorrow=[25:0x5dd8f8213250] <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