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)
#> <0x6c91aa8> #> Variables: #> * mpg: <0x5a88f70> #> * cyl: <0x5a890b0> #> * disp: <0x5a891f0> #> * hp: <0x5a89330> #> * drat: <0x587b230> #> * wt: <0x587b370> #> * qsec: <0x587b4b0> #> * vs: <0x587b5f0> #> * am: <0x587b730> #> * gear: <0x587b870> #> * carb: <0x587b9b0> #> Attributes: #> * names: <0x6c919f8> #> * row.names: <0x587baf0> #> * class: <0x549fc48>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0xdb0dd48> #> Variables: #> * mpg: <0x5a88f70> #> * cyl: <0x5a890b0> #> * disp: <0x5a891f0> #> * hp: <0x5a89330> #> * drat: <0x587b230> #> * wt: <0x587b370> #> * qsec: <0x587b4b0> #> * vs: <0x587b5f0> #> * am: <0x587b730> #> * gear: <0x587b870> #> * carb: <0x587b9b0> #> * cyl2: <0xce95840> #> Attributes: #> * names: <0xdb0db38> #> * class: <0x55ed9c0> #> * row.names: <0xd985720>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0xce95840 #> #> Changed attributes: #> old new #> names 0x6c919f8 0xdb0db38 #> row.names 0x587baf0 0xd1cb7c8 #> class 0x549fc48 0x55ed9c0