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)
#> <0x5640218a6708> #> Variables: #> * mpg: <0x564020f0e960> #> * cyl: <0x564022976ac0> #> * disp: <0x564022976bf0> #> * hp: <0x564020238a10> #> * drat: <0x564020238b40> #> * wt: <0x56402069b2a0> #> * qsec: <0x56402069b3d0> #> * vs: <0x564022970130> #> * am: <0x564022970260> #> * gear: <0x5640229735c0> #> * carb: <0x5640229736f0> #> Attributes: #> * names: <0x5640218a6660> #> * row.names: <0x5640229753f0> #> * class: <0x5640203c39c8>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0x56402158ab80> #> Variables: #> * mpg: <0x564020f0e960> #> * cyl: <0x564022976ac0> #> * disp: <0x564022976bf0> #> * hp: <0x564020238a10> #> * drat: <0x564020238b40> #> * wt: <0x56402069b2a0> #> * qsec: <0x56402069b3d0> #> * vs: <0x564022970130> #> * am: <0x564022970260> #> * gear: <0x5640229735c0> #> * carb: <0x5640229736f0> #> * cyl2: <0x564020741a80> #> Attributes: #> * class: <0x564023397898> #> * names: <0x56401f0ba988> #> * row.names: <0x5640211ce488>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x564020741a80 #> #> Changed attributes: #> old new #> names 0x5640218a6660 0x56401f0ba988 #> row.names 0x5640229753f0 0x56402227c128 #> class 0x5640203c39c8 0x564023397898