vendredi 4 janvier 2019

R - How to make an ifelse statement without error

I have to make an if statement but it says error I have a variabel called cancercode, i want the codes that are NOT equal to the codes stated below to state as "other" in dataframe.

 df6 <- df4x%>%
  mutate(sygdomsgruppex = ifelse(cancercode != "DC911", "DC833", "DC830", 
                             "DC910", "DC921", "DC831", "DC859","DC919", "DC911B",
                             "Other", cancercode))

This code gives me this error:

  Error in mutate_impl(.data, dots) : 
  Evaluation error: unused arguments ("DC910", "DC921", "DC831", "DC859","DC919", "DC911B", "other", cancerKode).

Aucun commentaire:

Enregistrer un commentaire