This is useful for understand how and when dplyr makes copies of data
frames
Usage
location(df)
changes(x, y)
Arguments
- df
a data frame
- x, y
two data frames to compare
Examples
location(mtcars)
#> Warning: `location()` was deprecated in dplyr 1.0.0.
#> Please use `lobst::ref()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> <0x563bf2312198>
#> Variables:
#> * mpg: <0x563bf606f3c0>
#> * cyl: <0x563bf606f530>
#> * disp: <0x563bf3d51a90>
#> * hp: <0x563bf3d51bd0>
#> * drat: <0x563bf3d51d10>
#> * wt: <0x563bf3e239e0>
#> * qsec: <0x563bf3e23b20>
#> * vs: <0x563bf3e23c60>
#> * am: <0x563bf6497880>
#> * gear: <0x563bf64979c0>
#> * carb: <0x563bf6497b00>
#> Attributes:
#> * names: <0x563bf23123a8>
#> * row.names: <0x563bf5a68fa0>
#> * class: <0x563bf50a4b10>
# ->
lobstr::ref(mtcars)
#> █ [1:0x563bf2312198] <df[,11]>
#> ├─mpg = [2:0x563bf606f3c0] <dbl>
#> ├─cyl = [3:0x563bf606f530] <dbl>
#> ├─disp = [4:0x563bf3d51a90] <dbl>
#> ├─hp = [5:0x563bf3d51bd0] <dbl>
#> ├─drat = [6:0x563bf3d51d10] <dbl>
#> ├─wt = [7:0x563bf3e239e0] <dbl>
#> ├─qsec = [8:0x563bf3e23b20] <dbl>
#> ├─vs = [9:0x563bf3e23c60] <dbl>
#> ├─am = [10:0x563bf6497880] <dbl>
#> ├─gear = [11:0x563bf64979c0] <dbl>
#> └─carb = [12:0x563bf6497b00] <dbl>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2)
# ->
lobstr::ref(mtcars2)
#> █ [1:0x563bf65e7268] <df[,12]>
#> ├─mpg = [2:0x563bf606f3c0] <dbl>
#> ├─cyl = [3:0x563bf606f530] <dbl>
#> ├─disp = [4:0x563bf3d51a90] <dbl>
#> ├─hp = [5:0x563bf3d51bd0] <dbl>
#> ├─drat = [6:0x563bf3d51d10] <dbl>
#> ├─wt = [7:0x563bf3e239e0] <dbl>
#> ├─qsec = [8:0x563bf3e23b20] <dbl>
#> ├─vs = [9:0x563bf3e23c60] <dbl>
#> ├─am = [10:0x563bf6497880] <dbl>
#> ├─gear = [11:0x563bf64979c0] <dbl>
#> ├─carb = [12:0x563bf6497b00] <dbl>
#> └─cyl2 = [13:0x563bf38b1ad0] <dbl>
changes(mtcars, mtcars2)
#> Warning: `changes()` was deprecated in dplyr 1.0.0.
#> Please use `lobstr::ref()` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> Changed variables:
#> old new
#> cyl2 <added> 0x563bf38b1ad0
#>
#> Changed attributes:
#> old new
#> names 0x563bf23123a8 0x563bf4221458
# ->
lobstr::ref(mtcars, mtcars2)
#> █ [1:0x563bf2312198] <df[,11]>
#> ├─mpg = [2:0x563bf606f3c0] <dbl>
#> ├─cyl = [3:0x563bf606f530] <dbl>
#> ├─disp = [4:0x563bf3d51a90] <dbl>
#> ├─hp = [5:0x563bf3d51bd0] <dbl>
#> ├─drat = [6:0x563bf3d51d10] <dbl>
#> ├─wt = [7:0x563bf3e239e0] <dbl>
#> ├─qsec = [8:0x563bf3e23b20] <dbl>
#> ├─vs = [9:0x563bf3e23c60] <dbl>
#> ├─am = [10:0x563bf6497880] <dbl>
#> ├─gear = [11:0x563bf64979c0] <dbl>
#> └─carb = [12:0x563bf6497b00] <dbl>
#>
#> █ [13:0x563bf65e7268] <df[,12]>
#> ├─mpg = [2:0x563bf606f3c0]
#> ├─cyl = [3:0x563bf606f530]
#> ├─disp = [4:0x563bf3d51a90]
#> ├─hp = [5:0x563bf3d51bd0]
#> ├─drat = [6:0x563bf3d51d10]
#> ├─wt = [7:0x563bf3e239e0]
#> ├─qsec = [8:0x563bf3e23b20]
#> ├─vs = [9:0x563bf3e23c60]
#> ├─am = [10:0x563bf6497880]
#> ├─gear = [11:0x563bf64979c0]
#> ├─carb = [12:0x563bf6497b00]
#> └─cyl2 = [14:0x563bf38b1ad0] <dbl>