This is useful for understand how and when dplyr makes copies of data frames

location(df)

changes(x, y)

Arguments

df

a data frame

x, y

two data frames to compare

Examples

location(mtcars)
#> <0x102c85ea0> #> Variables: #> * mpg: <0x101c28d80> #> * cyl: <0x101c28eb0> #> * disp: <0x101c48380> #> * hp: <0x101c484b0> #> * drat: <0x101c4da40> #> * wt: <0x101c4db70> #> * qsec: <0x101c4e8c0> #> * vs: <0x101c4e9f0> #> * am: <0x101c20610> #> * gear: <0x101c20740> #> * carb: <0x101c5adf0> #> Attributes: #> * names: <0x102c85f48> #> * row.names: <0x101c5af20> #> * class: <0x11177b2c8>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0x116945158> #> Variables: #> * mpg: <0x101c28d80> #> * cyl: <0x101c28eb0> #> * disp: <0x101c48380> #> * hp: <0x101c484b0> #> * drat: <0x101c4da40> #> * wt: <0x101c4db70> #> * qsec: <0x101c4e8c0> #> * vs: <0x101c4e9f0> #> * am: <0x101c20610> #> * gear: <0x101c20740> #> * carb: <0x101c5adf0> #> * cyl2: <0x109f9de10> #> Attributes: #> * class: <0x1123e26c8> #> * names: <0x116948698> #> * row.names: <0x1169418b0>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x109f9de10 #> #> Changed attributes: #> old new #> names 0x102c85f48 0x116948698 #> row.names 0x101c5af20 0x115b6a408 #> class 0x11177b2c8 0x1123e26c8