I'm having trouble with some data, and I think it's easy to solve. I have a subset like this:
data <- data.frame("treat" = 1:10, "value" = c(12,32,41,0,12,13,11,0,12,0))
And what I need is a third column that returns to me the value "1" when the value on second column is different from 0, and returns "0" when the value on the second column is equal 0. Like this:
data$param <- c(1,1,1,0,1,1,1,0,1,0)
I tried to do this with the function if() and else() but I don't get it.
Aucun commentaire:
Enregistrer un commentaire