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)
#> <0x55c084afa358> #> Variables: #> * mpg: <0x55c082d16850> #> * cyl: <0x55c082d16990> #> * disp: <0x55c082c65400> #> * hp: <0x55c082c65540> #> * drat: <0x55c082ac4140> #> * wt: <0x55c082ac4280> #> * qsec: <0x55c081c95350> #> * vs: <0x55c081c95490> #> * am: <0x55c082b32c90> #> * gear: <0x55c082b32dd0> #> * carb: <0x55c082b23f40> #> Attributes: #> * names: <0x55c084afa568> #> * row.names: <0x55c082b24080> #> * class: <0x55c0824f61f0>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0x55c08ba51128> #> Variables: #> * mpg: <0x55c082d16850> #> * cyl: <0x55c082d16990> #> * disp: <0x55c082c65400> #> * hp: <0x55c082c65540> #> * drat: <0x55c082ac4140> #> * wt: <0x55c082ac4280> #> * qsec: <0x55c081c95350> #> * vs: <0x55c081c95490> #> * am: <0x55c082b32c90> #> * gear: <0x55c082b32dd0> #> * carb: <0x55c082b23f40> #> * cyl2: <0x55c0872798b0> #> Attributes: #> * class: <0x55c0819c2f08> #> * names: <0x55c08ba50fc8> #> * row.names: <0x55c08a6f0320>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x55c0872798b0 #> #> Changed attributes: #> old new #> names 0x55c084afa568 0x55c08ba50fc8 #> row.names 0x55c082b24080 0x55c089869870 #> class 0x55c0824f61f0 0x55c0819c2f08