Rename data frame

I have a data.frame with name df. I would like to save it in a file with a better name. I would like to be able to do this:

df = ... rename.data.frame(df, "gdp_2001_2014") # Now the data.frame has a new name and can be used as normal: gdp_2001_2014$y = 0 # And it can be saved with a nice name: save(gdp_2001_2014, file=".\\datafile.Rdata")

The name is important of the following reason: when you load data the name follows automatically:

load(".\\datafile.Rdata") summary(gdp_2001_2014)


## to re-name the data frame gdp_2001_2014 <- df ## remove data frame 'df' rm(df) ## write new data frame to file write.table(gdp_2001_2014, file = "yourPath.Rdata")

Depending on the data, you could also use write.csv or writeLines and others.


you can do it in 1 call

write.csv(df,file="gdp_2001_2014.csv",row.names=FALSE) #row.names=FALSE if you don't want the row index


  • How can I resolve LNK4254 warnings in link.exe?
  • Creating package for Mac in Windows / Linux
  • Python missing image
  • Calling a FORTRAN DLL using ctypes
  • karplus equation in gnuplot
  • want to smooth a contour from a masked array
  • drop tablespace if do not exist
  • How to read data from a text file if the file location is not known in c#?
  • HTML code to upload images
  • NSMutableArray Access Issue
  • Nodejs bluebird promise fails while processing image
  • iOS 6 dateFromString returns wrong date
  • Zend Framework bassed projects
  • ZipList with Scalaz
  • Failed to find version-tag string. File must be updated
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • C#: Import/Export Settings into/from a File
  • Trying to get the char code of ENTER key
  • DIV instruction jumping to random location?
  • Clarification on min distance on LocationManager.requestLocationUpdates method, min Distance paramet
  • Using Sax parsing to edit and write XML in VB6
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Diff between two dataframes in pandas
  • Breaking out column by groups in Pandas
  • Loading .coffee files via a view in Rails
  • How do I superscript characters in a UIButton?
  • Moving Android View and preventing onDraw to be called over and over again
  • How can I set a binding to a Combox in a UserControl?
  • xtable package: Skipping some rows in the output
  • Debug.DrawLine not showing in the GameView
  • Create DicomImage from scratch using Dcmtk
  • AJAX Html Editor Extender upload image appearing blank
  • Yii2: Config params vs. const/define
  • R - Combining Columns to String Based on Logical Match
  • What is Eclipse's Declaration View used for?
  • swift auto completion not working in Xcode6-Beta
  • Excel - Autoshape get it's name from cell (value)
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • reshape alternating columns in less time and using less memory
  • How to load view controller without button in storyboard?