mercredi 4 avril 2018

ifelse statement in R won't work

this seems like a fairly simple question. But I'm trying to run this line of code:

data$testlow <- ifelse(data$final_remark == '<', 0, data$testlow)

And I keep getting this error:

Error in ans[!test & ok] <- rep(no, length.out = length(ans))[!test & : replacement has length zero In addition: Warning message: In rep(no, length.out = length(ans)) : 'x' is NULL so the result will be NULL

How can I fix this? Thank you!

Aucun commentaire:

Enregistrer un commentaire