On Tue, 02 Dec 2008 17:37:44 +0100, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:

As the help page says

      If some of the values are not vectors of the appropriate length,
      you deserve whatever you get!

So you can use

mtcars1 <- mtcars
mtcars1[c("t1", "t2")] <- cbind(rep(3,32), rep(4, 32))



Ok..I got it, it is an usual pain with R: vectors with length 1 are recycled and data.frames with nrows=1 and arrays with dim[1]=1 are not.

Will have to use

mtcars[c("t1","t2")]<-with(mtcars, cbind(t1=..., t2=...))

or rewrite transform.data.frame  myself.

Thanks a lot,

Vitalie.

______________________________________________
R-help@r-project.org 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.

Reply via email to