Skip to content
Prev 163683 / 398506 Next

Bug in "transform"?

Many thanks for your kind responses.
Related to above, I find rather inconsistent following behavior:
Error in data.frame(aq, list(a = 1, b = 2)) :
   arguments imply differing number of rows: 6, 1
Error in data.frame(..., check.names = FALSE) :
   arguments imply differing number of rows: 6, 1

but,

aq[c("a","b")]<-list(1,2) #works fine

In my understanding all versions above are conceptually similar and should  
behave in a same way, and recycling for one row data.frames should be a  
default. R is an interactive language and behavior like above is a real  
pain.
I really try to use indexing in code all the time I possibly can. But for  
interactive use with dozens of data transformations and reshapings per day  
- with just indexing I  would probably see stars at the end of the day.  
Thanks for existence of such "syntactic sugars" and for packages like   
Hadley's reshape and plyr.

Regards,
Vitalie.