Message-ID: <op.uljo6nduw9ljuw@tir-070312.staff.few.eur.nl>
Date: 2008-12-02T17:21:49Z
From: Vitalie S.
Subject: Bug in "transform"?
In-Reply-To: <49356458.6020502@stats.ox.ac.uk>
On Tue, 02 Dec 2008 17:37:44 +0100, Prof Brian Ripley
<ripley at stats.ox.ac.uk> 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.