Hello,
Your example code has a bug, there's no fata.frame called 'AB'. It's
corrected below.
pannigh wrote
>
> 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 exa
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
2 matches
Mail list logo