vendredi 23 juillet 2021

ifelse issues in R Studio

I am trying to write an ifelse statement to classify my data, but it is not working properly. I need my data set to make a column that classifies a number as EARLY if its between 600-1200. If not, it should read LATE. My data set contains numbers between 1-2000. However, when I run my code everything shows up as LATE. What gives?

my_data <- my_data %>%
mutate(
data_type = ifelse(time >= 600 & time <= 1200, "EARLY", "LATE")
) %>%
group_by(data_type) %>%
summarize(totals = random_number) #this part is misc
my_data

Aucun commentaire:

Enregistrer un commentaire