[Rd] dput/dget when a data frame has 2 rows (PR#9627)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Apr 23 09:30:13 CEST 2007


It is right.

The problem is that dput() does not give a faithful representation, as its 
help says.  R 2.5.0 does a better job, since the defaults for dput() have 
been changed, enough so that your example works there.


On Sun, 22 Apr 2007, pdmmac at mcmaster.ca wrote:

> This doesn't seem right; I'm using R version 2.4.1 (2006-12-18) on Mac OS
> and Win XP and find the same issue:
>
>> mydataframe <- data.frame(ppi=c(.5,.5),mmu=c(5,10))
>> dput(mydataframe,"mydataframe.txt")
>> dget("mydataframe.txt")
> Error in attributes(.Data) <- c(attributes(.Data), attrib) :
>    row names must be 'character' or 'integer', not 'double'
>> mydataframe3 <- data.frame(ppi=c(.5,.5,.5),mmu=c(5,10,15))
>> dput(mydataframe3,"mydataframe3.txt")
>> dget("mydataframe3.txt")
>  ppi mmu
> 1 0.5   5
> 2 0.5  10
> 3 0.5  15
>
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list