[Rd] Don't dput() data frames?

From: R. Michael Weylandt <michael.weylandt_at_gmail.com>
Date: Tue, 28 Aug 2012 12:51:27 -0500


/src/main/attrib.c contains this comment in row_names_gets():

  /* This should not happen, but if a careless user dput()s a

           data frame and sources the result, it will */

which svn blame says Prof Ripley placed there in r39830 with the commit message "correct the work of dput() on the row names of a data frame with compact representation."

Is there a problem / better way to use the result of a hefty dput than source()ing it? This seems to work rather robustly:

data(iris)
source(textConnection(paste0("iris2 <- ", capture.output(dput(iris))))) identical(iris, iris2)

Cheers,
Michael



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 28 Aug 2012 - 17:54:06 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 28 Aug 2012 - 18:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive