5

I wish to rename an entire data-frame on r (Eg. rename df1 to df 2). So far I always do this by...

df2 <- df1 df1 <- NULL

But when handling massive datasets this results in memory issues. All of my search on SO and google have only showed results to rename the column names of dataframes (rename() function in package 'reshape' or assign() function, but it doesn't work on entire dataframe). Is there a way to do this without creating a new dataframe?

Gaurav
  • 1,597
  • 2
  • 14
  • 31
  • 3
    To remove `df1`, do `rm(df1)`, not `df1 <- NULL` (which leaves a new object named `df1` in your workspace.) – Josh O'Brien Aug 27 '15 at 06:56
  • 2
    And for more detail on why doing `df2 <- df1` doesn't actually create a whole new copy of the data referenced by `df1`, see [this excellent answer](http://stackoverflow.com/questions/15759117/what-exactly-is-copy-on-modify-semantics-in-r-and-where-is-the-canonical-source/15764949#15764949) – Josh O'Brien Aug 27 '15 at 07:06

0 Answers0