I am attempting to select all TRUE values that are above 3.0 and replace the TF column too FALSE. I can do this but am having trouble replacing it in the original data frame. Suggestions?
df <- data.frame("TF" = c("TRUE", "FALSE", "TRUE", "TRUE", "FALSE", "FALSE"),
"Number" = c(4.0, 4.0, 3.0, 2.5, 3.0, 1.0))
df %>%
filter(TF == TRUE) %>%
filter(Number <= 3) %>%
mutate(TF = FALSE)
The final data frame should be:
"TF" = c("TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE")
"Number" = c(4.0, 4.0, 3.0, 2.5, 3.0, 1.0)