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)
#> <0x7436638> #> Variables: #> * mpg: <0x6e8b320> #> * cyl: <0x6dd1d00> #> * disp: <0x6ffc4f0> #> * hp: <0xa35c510> #> * drat: <0x7a7bdd0> #> * wt: <0x7bceb90> #> * qsec: <0x7c6a620> #> * vs: <0x7d7b5d0> #> * am: <0x2bd5270> #> * gear: <0x6f29860> #> * carb: <0x6e996c0> #> Attributes: #> * names: <0x74366e8> #> * row.names: <0x4751ac0> #> * class: <0x799c068>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0xa1e5b88> #> Variables: #> * mpg: <0x6e8b320> #> * cyl: <0x6dd1d00> #> * disp: <0x6ffc4f0> #> * hp: <0xa35c510> #> * drat: <0x7a7bdd0> #> * wt: <0x7bceb90> #> * qsec: <0x7c6a620> #> * vs: <0x7d7b5d0> #> * am: <0x2bd5270> #> * gear: <0x6f29860> #> * carb: <0x6e996c0> #> * cyl2: <0x7ef04a0> #> Attributes: #> * names: <0xa1e5a28> #> * class: <0x798dfc0> #> * row.names: <0x40b8f00>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x7ef04a0 #> #> Changed attributes: #> old new #> names 0x74366e8 0xa1e5a28 #> row.names 0x4751ac0 0xf22d3c8 #> class 0x799c068 0x798dfc0