Re: [R] Problem with as.data.frame when an extra attribute is present

2006-11-10 Thread Prof Brian Ripley
It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if necessary. data.frame(a =

Re: [R] Problem with as.data.frame when an extra attribute is present

2006-11-10 Thread Frank E Harrell Jr
Prof Brian Ripley wrote: It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by 'I' will be recycled a whole number of times if

Re: [R] Problem with as.data.frame when an extra attribute is present

2006-11-10 Thread Prof Brian Ripley
On Fri, 10 Nov 2006, Frank E Harrell Jr wrote: Prof Brian Ripley wrote: It's quite intentional, as it is the documented behaviour of data.frame: Objects passed to 'data.frame' should have the same number of rows, but atomic vectors, factors and character vectors protected by

[R] Problem with as.data.frame when an extra attribute is present

2006-11-09 Thread Frank E Harrell Jr
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