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)
#> <0x56517328b978> #> Variables: #> * mpg: <0x56516dc228b0> #> * cyl: <0x565173ce0bc0> #> * disp: <0x565173d2e9e0> #> * hp: <0x565173d2eb20> #> * drat: <0x56516eb78710> #> * wt: <0x56516eb78850> #> * qsec: <0x5651733a9c50> #> * vs: <0x5651733a9d90> #> * am: <0x5651718424d0> #> * gear: <0x565171842610> #> * carb: <0x56516c815da0> #> Attributes: #> * names: <0x56517328b8c8> #> * row.names: <0x56516c815ee0> #> * class: <0x56516f9ed5d8>
mtcars2 <- mutate(mtcars, cyl2 = cyl * 2) location(mtcars2)
#> <0x565180809d38> #> Variables: #> * mpg: <0x56516dc228b0> #> * cyl: <0x565173ce0bc0> #> * disp: <0x565173d2e9e0> #> * hp: <0x565173d2eb20> #> * drat: <0x56516eb78710> #> * wt: <0x56516eb78850> #> * qsec: <0x5651733a9c50> #> * vs: <0x5651733a9d90> #> * am: <0x5651718424d0> #> * gear: <0x565171842610> #> * carb: <0x56516c815da0> #> * cyl2: <0x56517786ef50> #> Attributes: #> * names: <0x565180809b28> #> * class: <0x56516fbcba38> #> * row.names: <0x5651781fb9f8>
changes(mtcars, mtcars)
#> <identical>
changes(mtcars, mtcars2)
#> Changed variables: #> old new #> cyl2 <added> 0x56517786ef50 #> #> Changed attributes: #> old new #> names 0x56517328b8c8 0x565180809b28 #> row.names 0x56516c815ee0 0x5651750036d0 #> class 0x56516f9ed5d8 0x56516fbcba38