[Rd] data.frame replacement (PR#4820)

Mark.Bravington at csiro.au Mark.Bravington at csiro.au
Tue Oct 28 07:29:37 MET 2003


When replacing all elements of a column in a data.frame, a corrupt data.frame will be generated if the replacer is "short":

test> bbb <- data.frame( x=1:2)
test> bbb[,'x'] <- 3 # should fill the column
test> bbb
     x
1    3
2 <NA>
Warning message: 
corrupt data frame: columns will be truncated or padded with NAs in: format.data.frame(x, digits = digits) 
test> bbb$x
[1] 2

This works OK in R 1.7.1 and also for matrices in R 1.8. Although there have been a number of deliberate changes to data.frame subscripting in R 1.8, I suspect this one isn't intentional!

NB still happens in 1.8.1 alpha

Mark

*******************************

Mark Bravington
CSIRO (CMIS)
PO Box 1538
Castray Esplanade
Hobart
TAS 7001

phone (61) 3 6232 5118
fax (61) 3 6232 5012
Mark.Bravington at csiro.au 

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 8.0
 year = 2003
 month = 10
 day = 08
 language = R

Windows 2000 Professional (build 2195) Service Pack 4.0

Search Path:
 .GlobalEnv, ROOT, package:lattice, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, package:handy, package:debug, mvb.session.info, package:mvbutils, package:tcltk, Autoloads, package:base



More information about the R-devel mailing list