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:0x58af415e6e60] <tibble[,24]> 
## ├─Date=[2:0x58af42596ff0] <date> 
## ├─Location=[3:0x58af425999e0] <chr> 
## ├─MinTemp=[4:0x58af4b8105b0] <dbl> 
## ├─MaxTemp=[5:0x58af4840e000] <dbl> 
## ├─Rainfall=[6:0x58af460a47c0] <dbl> 
## ├─Evaporation=[7:0x58af42f70bc0] <dbl> 
## ├─Sunshine=[8:0x58af42f86160] <dbl> 
## ├─WindGustDir=[9:0x58af42f86d10] <ord> 
## ├─WindGustSpeed=[10:0x58af3c6ad370] <dbl> 
## ├─WindDir9am=[11:0x58af42f71770] <ord> 
## ├─WindDir3pm=[12:0x58af3c6adf20] <ord> 
## ├─WindSpeed9am=[13:0x58af40b2d2d0] <dbl> 
## ├─WindSpeed3pm=[14:0x58af48707a30] <dbl> 
## ├─Humidity9am=[15:0x58af487085e0] <int> 
## ├─Humidity3pm=[16:0x58af40b2de80] <int> 
## ├─Pressure9am=[17:0x58af465c1800] <dbl> 
## ├─Pressure3pm=[18:0x58af414a41d0] <dbl> 
## ├─Cloud9am=[19:0x58af465c23b0] <int> 
## ├─Cloud3pm=[20:0x58af414a4d80] <int> 
## ├─Temp9am=[21:0x58af469423f0] <dbl> 
## ├─Temp3pm=[22:0x58af49adb9c0] <dbl> 
## ├─RainToday=[23:0x58af49adc570] <fct> 
## ├─RISK_MM=[24:0x58af457a9ff0] <dbl> 
## └─RainTomorrow=[25:0x58af46942fa0] <fct>
lobstr::ref(ds)
## █ [1:0x58af4121ece0] <tibble[,24]> 
## ├─date=[2:0x58af442d8dd0] <date> 
## ├─location=[3:0x58af40925a60] <chr> 
## ├─min_temp=[4:0x58af44689820] <dbl> 
## ├─max_temp=[5:0x58af44844a00] <dbl> 
## ├─rainfall=[6:0x58af40c70cc0] <dbl> 
## ├─evaporation=[7:0x58af40e2bea0] <dbl> 
## ├─sunshine=[8:0x58af434ec870] <dbl> 
## ├─wind_gust_dir=[9:0x58af441efa00] <ord> 
## ├─wind_gust_speed=[10:0x58af436a7a50] <dbl> 
## ├─wind_dir_9am=[11:0x58af44542a80] <ord> 
## ├─wind_dir_3pm=[12:0x58af429844e0] <ord> 
## ├─wind_speed_9am=[13:0x58af43862c30] <dbl> 
## ├─wind_speed_3pm=[14:0x58af43a2ea80] <dbl> 
## ├─humidity_9am=[15:0x58af40fe7080] <int> 
## ├─humidity_3pm=[16:0x58af43be9c60] <int> 
## ├─pressure_9am=[17:0x58af43cc7570] <dbl> 
## ├─pressure_3pm=[18:0x58af43e82750] <dbl> 
## ├─cloud_9am=[19:0x58af44c4e4d0] <int> 
## ├─cloud_3pm=[20:0x58af44d2bde0] <int> 
## ├─temp_9am=[21:0x58af44e096f0] <dbl> 
## ├─temp_3pm=[22:0x58af44fc48d0] <dbl> 
## ├─rain_today=[23:0x58af4517fab0] <fct> 
## ├─risk_mm=[24:0x58af4525d3c0] <dbl> 
## └─rain_tomorrow=[25:0x58af454185a0] <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