Displaying 1 result from an estimated 1 matches for "tp4590153p4590279".
2012 Apr 26
1
Using if and else in a data frame
Dear list,
I get the ifelse function to work on a data frame but don't know how to do
something similar (only more conditions) with the combination of if and else
like in the example:
A <- c("a","a","b","b","c","c")
B <- c(rep(2,6))
dat <- data.frame(A,B)
dat$C <- if(AB$A=="a") {AB$B^2} else