Closed jlin47 closed 6 years ago
Solution: use as.numeric()
trails_1<- trails %>% group_by(name) %>% summarize(num_segments = n(), total_length = sum(computed_length)) %>% arrange(desc(total_length))%>% mutate (Difficulty= if_else(as.numeric(total_length)<1000, "Easy", ifelse(as.numeric(total_length)<2000, "Moderate", "Hard")))
trails_1<- trails %>% group_by(name) %>% summarize(num_segments = n(), total_length = sum(computed_length)) %>% arrange(desc(total_length))%>% mutate (Difficulty= if_else(total_length<1000, "Easy", ifelse(total_length<2000, "Moderate", "Hard")))
Error in mutate_impl(.data, dots) : Evaluation error: both operands of the expression should be "units" objects.