[Rd] error in dput applied to dataframe (PR#9286)

higgins at nceas.ucsb.edu higgins at nceas.ucsb.edu
Tue Oct 10 22:28:02 CEST 2006


Full_Name: Daniel F Higgins
Version: 2.4.0
OS: Windows XP and Mac OSX
Submission from: (NULL) (128.111.242.49)


Create a dataframe as indicated below and apply 'dput' to it; note that the
row.names attribute is incorrect!

> aaa <- c("AAA","BBB","AAA")
> bbb <- c(1,2,3)
> df <- data.frame(aaa,bbb)
> dput(df)
structure(list(aaa = structure(c(1, 2, 1), .Label = c("AAA", 
"BBB"), class = "factor"), bbb = c(1, 2, 3)), .Names = c("aaa", 
"bbb"), row.names = c(NA, 3), class = "data.frame")
> dput(df,file="puttest.R")
> dget("puttest.R")
Error in attributes(.Data) <- c(attributes(.Data), attrib) : 
        row names must be 'character' or 'integer', not 'double'
>

However, if R version 2.3 is used, the value for row.names is:
row.names = c("1", "2", "3")
and the dget command then works




More information about the R-devel mailing list