10.26 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.

location(weather)
## Warning: `location()` was deprecated in dplyr 1.0.0.
## Please use `lobst::ref()` instead.
## <0x558a46a96730>
## Variables:
##  * Date:          <0x558a45f65590>
##  * Location:      <0x558a42178f50>
##  * MinTemp:       <0x558a37121cd0>
##  * MaxTemp:       <0x558a40fe7dc0>
##  * Rainfall:      <0x558a40f73f40>
##  * Evaporation:   <0x558a42869720>
##  * Sunshine:      <0x558a44a0afc0>
##  * WindGustDir:   <0x558a46198cd0>
##  * WindGustSpeed: <0x558a425046e0>
##  * WindDir9am:    <0x558a4850a8b0>
##  * WindDir3pm:    <0x558a47630a30>
##  * WindSpeed9am:  <0x558a4a5f0aa0>
##  * WindSpeed3pm:  <0x558a44a84b30>
##  * Humidity9am:   <0x558a4630e500>
##  * Humidity3pm:   <0x558a41f9bae0>
##  * Pressure9am:   <0x558a4a6ec080>
##  * Pressure3pm:   <0x558a472f84a0>
##  * Cloud9am:      <0x558a49e4b730>
##  * Cloud3pm:      <0x558a48caf8a0>
##  * Temp9am:       <0x558a47840480>
##  * Temp3pm:       <0x558a401a5290>
##  * RainToday:     <0x558a41150c00>
##  * RISK_MM:       <0x558a4a5143d0>
##  * RainTomorrow:  <0x558a466d82d0>
## Attributes:
##  * names:         <0x558a456bc560>
##  * row.names:     <0x558a43ed44b0>
##  * class:         <0x558a47cd2738>
location(ds)
## <0x558a3a73f3d0>
## Variables:
##  * date:            <0x558a42d221d0>
##  * location:        <0x558a3d73e3a0>
##  * min_temp:        <0x558a48cd4540>
##  * max_temp:        <0x558a491c0ab0>
##  * rainfall:        <0x558a49319e40>
##  * evaporation:     <0x558a43681ea0>
##  * sunshine:        <0x558a437db230>
##  * wind_gust_dir:   <0x558a45d56220>
##  * wind_gust_speed: <0x558a48712ba0>
##  * wind_dir_9am:    <0x558a458065c0>
##  * wind_dir_3pm:    <0x558a3d897730>
##  * wind_speed_9am:  <0x558a4886bf30>
##  * wind_speed_3pm:  <0x558a489c52c0>
##  * humidity_9am:    <0x558a439345c0>
##  * humidity_3pm:    <0x558a458c30e0>
##  * pressure_9am:    <0x558a48b1e650>
##  * pressure_3pm:    <0x558a49484a50>
##  * cloud_9am:       <0x558a459fc400>
##  * cloud_3pm:       <0x558a45e897e0>
##  * temp_9am:        <0x558a495ddde0>
##  * temp_3pm:        <0x558a49737170>
##  * rain_today:      <0x558a46cbc550>
##  * risk_mm:         <0x558a49890500>
##  * rain_tomorrow:   <0x558a48e2d8d0>
## Attributes:
##  * names:           <0x558a416ea820>
##  * row.names:       <0x558a43cba628>
##  * class:           <0x558a48710cd8>


Your donation will support ongoing development 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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.