[R] Bug in "transform"?

hadley wickham h.wickham at gmail.com
Wed Dec 3 05:04:46 CET 2008


> The underlying issue is actually not in transform() but in data.frame():
>
>> aq <- airquality[sample(1:153,6),]
>> data.frame(aq, list(a=1,b=2))
> Error in data.frame(aq, list(a = 1, b = 2)) :
>  arguments imply differing number of rows: 6, 1
>> data.frame(aq, list(a=1))
>    Ozone Solar.R Wind Temp Month Day a
> 3      12     149 12.6   74     5   3 1
> 31     37     279  7.4   76     5  31 1
> 34     NA     242 16.1   67     6   3 1
> 65     NA     101 10.9   84     7   4 1
> 59     NA      98 11.5   80     6  28 1
> 133    24     259  9.7   73     9  10 1
>

Is this a bug or a "feature"?

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list