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:0x65522c9ea8d0] <tibble[,24]> 
## ├─Date=[2:0x65521d0eb760] <date> 
## ├─Location=[3:0x655218d92300] <chr> 
## ├─MinTemp=[4:0x65522731ef00] <dbl> 
## ├─MaxTemp=[5:0x6552266f2510] <dbl> 
## ├─Rainfall=[6:0x65522662c880] <dbl> 
## ├─Evaporation=[7:0x65521cb618c0] <dbl> 
## ├─Sunshine=[8:0x655218e81d20] <dbl> 
## ├─WindGustDir=[9:0x655221c00730] <ord> 
## ├─WindGustSpeed=[10:0x655218dbd6a0] <dbl> 
## ├─WindDir9am=[11:0x65521c202dc0] <ord> 
## ├─WindDir3pm=[12:0x65522574a450] <ord> 
## ├─WindSpeed9am=[13:0x655218da63b0] <dbl> 
## ├─WindSpeed3pm=[14:0x655224676620] <dbl> 
## ├─Humidity9am=[15:0x65521f6b1f10] <int> 
## ├─Humidity3pm=[16:0x65521d47e890] <int> 
## ├─Pressure9am=[17:0x655218e99010] <dbl> 
## ├─Pressure3pm=[18:0x655218dffe40] <dbl> 
## ├─Cloud9am=[19:0x655223e7b180] <int> 
## ├─Cloud3pm=[20:0x655223f5bb00] <int> 
## ├─Temp9am=[21:0x655218dcec30] <dbl> 
## ├─Temp3pm=[22:0x655218e4f8a0] <dbl> 
## ├─RainToday=[23:0x65522560fd90] <fct> 
## ├─RISK_MM=[24:0x655218e132f0] <dbl> 
## └─RainTomorrow=[25:0x65522856b390] <fct>
lobstr::ref(ds)
## █ [1:0x65522ac9fa30] <tibble[,24]> 
## ├─date=[2:0x655221c02fb0] <date> 
## ├─location=[3:0x65521f840280] <chr> 
## ├─min_temp=[4:0x6552217bdc70] <dbl> 
## ├─max_temp=[5:0x655222951820] <dbl> 
## ├─rainfall=[6:0x655222b0ca00] <dbl> 
## ├─evaporation=[7:0x655221faa750] <dbl> 
## ├─sunshine=[8:0x655222165930] <dbl> 
## ├─wind_gust_dir=[9:0x655222cc7be0] <ord> 
## ├─wind_gust_speed=[10:0x6552206c0010] <dbl> 
## ├─wind_dir_9am=[11:0x655222320b10] <ord> 
## ├─wind_dir_3pm=[12:0x65521f9fb460] <ord> 
## ├─wind_speed_9am=[13:0x65522087b1f0] <dbl> 
## ├─wind_speed_3pm=[14:0x655220a363d0] <dbl> 
## ├─humidity_9am=[15:0x655221e7f810] <int> 
## ├─humidity_3pm=[16:0x6552200b6590] <int> 
## ├─pressure_9am=[17:0x655220eb0d90] <dbl> 
## ├─pressure_3pm=[18:0x65522106bf70] <dbl> 
## ├─cloud_9am=[19:0x6552201d5a20] <int> 
## ├─cloud_3pm=[20:0x65521fde0900] <int> 
## ├─temp_9am=[21:0x655221227150] <dbl> 
## ├─temp_3pm=[22:0x655223765120] <dbl> 
## ├─rain_today=[23:0x655221978e50] <fct> 
## ├─risk_mm=[24:0x655223920300] <dbl> 
## └─rain_tomorrow=[25:0x65522045eb90] <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