lundi 31 juillet 2017

Using if, else within recode

I am trying to replicate some code but not having much luck. data$var1 has values from 1-7 which I am trying to reduce to just 2 value in a new variable, data$var2. The code looks like this: data$var2<-recode(data$var1, "1:3=1; else=0")

However, when I execute code, I get the following error: "Error: Argument 2 must be named, not unnamed"

I'm working in the latest version of R and using the Tidyverse package.

What am I missing? What about Argument 2 isn't named?

Aucun commentaire:

Enregistrer un commentaire