Skip to content
Back to formatted view

Raw Message

Message-ID: <20061010202802.94EA4A26A@slim.kubism.ku.dk>
Date: 2006-10-10T20:28:02Z
From: higgins at nceas.ucsb.edu
Subject: error in dput applied to dataframe (PR#9286)

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