I have a problem when one of the vectors in a list needs to be
replicated to have the appropriate length, and an attribute is present.
> w <- list(a=1, b=2:3)
> as.data.frame(w)
a b
1 1 2
2 1 3
> attr(w$a,'label') <- 'foo'
> as.data.frame(w)
Error in data.frame(a = 1, b = c(2, 3), check.names = TRUE) :
arguments imply differing number of rows: 1, 2
I usually use the Hmisc label function to make a variable of class
'labelled' and define as.data.frame.labelled as as.data.frame.vector,
but that also fails here. Any help appreciated. -Frank
> sessionInfo()
R version 2.2.1, 2005-12-20, i486-pc-linux-gnu [also fails in 2.4.0]
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.