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)
#> <0x8cd1ce8> #> Variables: #> * mpg: <0x799c5e0> #> * cyl: <0x6a7af90> #> * disp: <0x6a7b0d0> #> * hp: <0x6a7b210> #> * drat: <0x6a7b350> #> * wt: <0x8aa9eb0> #> * qsec: <0x8aa9ff0> #> * vs: <0x8aaa130> #> * am: <0x8aaa270> #> * gear: <0x8aaa3b0> #> * carb: <0x8aaa4f0> #> Attributes: #> * names: <0x8cd1c38> #> * row.names: <0x8aaa630> #> * class: <0x81f21b0>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0x7456ac8> #> Variables: #> * mpg: <0x799c5e0> #> * cyl: <0x6a7af90> #> * disp: <0x6a7b0d0> #> * hp: <0x6a7b210> #> * drat: <0x6a7b350> #> * wt: <0x8aa9eb0> #> * qsec: <0x8aa9ff0> #> * vs: <0x8aaa130> #> * am: <0x8aaa270> #> * gear: <0x8aaa3b0> #> * carb: <0x8aaa4f0> #> * cyl2: <0x736cde0> #> Attributes: #> * names: <0x7456968> #> * class: <0x82a8100> #> * row.names: <0x9bd0b90>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x736cde0 #> #> Changed attributes: #> old new #> names 0x8cd1c38 0x7456968 #> row.names 0x8aaa630 0xafb15a8 #> class 0x81f21b0 0x82a8100