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 = 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 for any idea! > Patrick > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.