Hi there, i'm new to R and this is my first question!
I'm trying to create a new variable 'Age_category' by cutting ClientAge into groups, however I keep getting error messages that the object is not found. I used
Better_health1$ClientAge <- as.numeric(Better_health1$ClientAge) to ensure that ClientAge was numeric, and it identifies ClientAge when typing the code. Can anyone help me out with this??
Better_health1 %>%
Better_health1$Age_category <- cut(ClientAge, c(-1, 9, 18, 40, 60, 80, 110), labels=c("0-9", "10-18", "18-40", "40-60", "60-80", "80+"))
#> Error in cut(ClientAge, c(-1, 9, 18, 40, 60, 80, 110), labels = c("0-9", : object 'ClientAge' not found