mercredi 2 octobre 2019

How can I create a new column with two new categories?

I am trying to create a new column named AgeClass with two new categories ("Juvenile" and "Adult") based off the HatchMass in a Tibble I formed. The "Adult" category is pretty much any NA value in that column. The I have tried the following code:

PBTdata %>% PBTdata

mutate(AgeClass = ifelse(HatchMass != is.na(HatchMass), "Juvenile", "Adult"))

I keep getting an output that has an AgeClass column but it only outputs the "Juvenile" category and leaves the "Adult" as NA. How can I change the NA values so that they are categorized as "Adult"?

Aucun commentaire:

Enregistrer un commentaire