Hi,

`[<-.data.frame` is cautious about not leaving holes after existing
columns:

  > `[<-`(data.frame(id=1:6), 3, value=data.frame(V3=11:16))
Error in `[<-.data.frame`(data.frame(id = 1:6), 3, value = data.frame(V3 = 11:16)) :
    new columns would leave holes after existing columns

but `[[<-.data.frame` not so much:

  > `[[<-`(data.frame(id=1:6), 3, value=11:16)
    id      V3
  1  1 NULL 11
  2  2 <NA> 12
  3  3 <NA> 13
  4  4 <NA> 14
  5  5 <NA> 15
  6  6 <NA> 16
  Warning message:
  In format.data.frame(x, digits = digits, na.encode = FALSE) :
    corrupt data frame: columns will be truncated or padded with NAs

The latter should probably behave like the former in that case. Maybe
by sharing more code with it?

Thanks,
H.


--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to