to the person who just asked about the feather and jet problem: i lost your email but below works. there should be a shorter way by avoiding the last statement and doing everything in the lapply but I've had enough of feathers and jets tonight.

m <- data.frame(class = c("birds", "planes"), feather = c(1,3), jet = c(2,4))
d1 <- data.frame(jet = c(10), feather = c(20))

result <- lapply(names(m[,-1]), function(.name) {
          m[[.name]]*d1[[.name]]
        })

result <- data.frame(m$class,feather=result[[1]],jet=result[[2]])
print(result)

______________________________________________
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