Skip to content
Prev 265324 / 398502 Next

For applying formula in rows

Bansal, Vikas wrote:
Reading the data the same was as Joshua

df <- read.table("summary.txt", header = TRUE)
str(df)
df[, "total"] <- rowSums(df[, 3:6])

and then why not just

df[, 3:6] <- df[, 3:6] / df[, "total"] * df[, "new"] * 2


Berend


--
View this message in context: http://r.789695.n4.nabble.com/For-applying-formula-in-rows-tp3662875p3664410.html
Sent from the R help mailing list archive at Nabble.com.