Dear R experts, I remember a similar function existed and have been mentioned in R-help before. I tried my best to search but I really can't find it out. suppose I have an data frame like this:> somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l = -1.013, m=16.133, s=0.07656)In order to back up the data and I don't want to use write.table(), I would like to back up the "source code" of the data frame. When I apply that function (let's call it dumpdf() ), the function will reproduce the "source code" that creates the data.frame. For example:> dumpdf(somedata)somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l -1.013, m=16.133, s=0.07656) Is there any function similar to the dumpdf() above? Thank you so much! Regards, CH -- CH Chan
Hi CH, Take a look at ?dput HTH, Jorge On Wed, Apr 13, 2011 at 3:09 AM, C.H. <> wrote:> Dear R experts, > > I remember a similar function existed and have been mentioned in > R-help before. I tried my best to search but I really can't find it > out. > > suppose I have an data frame like this: > > > somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l > -1.013, m=16.133, s=0.07656) > > In order to back up the data and I don't want to use write.table(), I > would like to back up the "source code" of the data frame. When I > apply that function (let's call it dumpdf() ), the function will > reproduce the "source code" that creates the data.frame. For example: > > > dumpdf(somedata) > somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l > -1.013, m=16.133, s=0.07656) > > Is there any function similar to the dumpdf() above? > > Thank you so much! > > Regards, > > CH > > -- > CH Chan > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
If you want to save it so that you can read it back later, then look at 'save' and 'load'. On Wed, Apr 13, 2011 at 3:09 AM, C.H. <chainsawtiney at gmail.com> wrote:> Dear R experts, > > I remember a similar function existed and have been mentioned in > R-help before. I tried my best to search but I really can't find it > out. > > suppose I have an data frame like this: > >> somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l = -1.013, m=16.133, s=0.07656) > > In order to back up the data and I don't want to use write.table(), I > would like to back up the "source code" of the data frame. When I > apply that function (let's call it dumpdf() ), the function will > reproduce the "source code" that creates the data.frame. For example: > >> dumpdf(somedata) > somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l > -1.013, m=16.133, s=0.07656) > > Is there any function similar to the dumpdf() above? > > Thank you so much! > > Regards, > > CH > > -- > CH Chan > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve?