From higgins at nceas.ucsb.edu  Tue Oct 10 22:28:02 2006
From: higgins at nceas.ucsb.edu (higgins at nceas.ucsb.edu)
Date: Tue, 10 Oct 2006 22:28:02 +0200 (CEST)
Subject: [Rd] error in dput applied to dataframe (PR#9286)
Message-ID: <20061010202802.94EA4A26A@slim.kubism.ku.dk>

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




[Rd] error in dput applied to dataframe (PR#9286)
higgins at nceas.ucsb.edu