[R] Suggestion for the posting guide

Gabor Grothendieck ggrothendieck at gmail.com
Thu Apr 21 19:04:56 CEST 2005


On 4/21/05, Bock, Michael <MBock at arcadis-us.com> wrote:

> Is there an easier way to export a SMALL data frame so you can recreate it
> using the example code that can be placed in the posting guide? Is it
> really a good idea to show people how to do this as we run the risk of
> someone sending a huge e-mail? Perhaps the "manual method" is really the
> best way to go, submitted for your consideration.

head will pick off the first few rows and dput will output it in a format
that can be pasted back into a session, e.g. 


> data(iris)
> irish <- head(iris)
> dput(irish)
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4), 
    Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), Petal.Length = c(1.4, 
    1.4, 1.3, 1.5, 1.4, 1.7), Petal.Width = c(0.2, 0.2, 0.2, 
    0.2, 0.2, 0.4), Species = structure(c(1, 1, 1, 1, 1, 1), .Label =
c("setosa",
    "versicolor", "virginica"), class = "factor")), .Names = c("Sepal.Length", 
"Sepal.Width", "Petal.Length", "Petal.Width", "Species"), row.names = c("1", 
"2", "3", "4", "5", "6"), class = "data.frame")




More information about the R-help mailing list