Try this:
x1 <- transform(iris, g = iris[-ncol(iris)] * (as.numeric(iris$Species) + 1
))
On Wed, Feb 23, 2011 at 6:11 AM, Patrick Hausmann <
patrick.hausm...@uni-bremen.de> wrote:
> Dear list,
>
> this works fine:
>
> x <- split(iris, iris$Species)
> x1 <- lapply(x, function(L) transform(L, g =
On Feb 23, 2011, at 4:11 AM, Patrick Hausmann wrote:
Dear list,
this works fine:
x <- split(iris, iris$Species)
x1 <- lapply(x, function(L) transform(L, g = L[,1:4] * 3))
but I would like to multiply each Species with another factor:
You will probably confuse yourself by not adopting R ter
Dear list,
this works fine:
x <- split(iris, iris$Species)
x1 <- lapply(x, function(L) transform(L, g = L[,1:4] * 3))
but I would like to multiply each Species with another factor:
setosa by 2, versicolor by 3 and virginica by 4. I've tried mapply but
without success.
Any thoughts? Thanks fo
3 matches
Mail list logo