I have a set of results from a survey (had to cut down the actual results):
structure(list(`What is your age?` = c("65+", "65+", "65+", "25-34",
"45-54", "65+"), `Gender identity` = c("Female", "Female", "Male",
"Non-Binary", "Female", "Female")), row.names = 3:8, class = "data.frame")
And I want to separate the age range column into a min age and max age column, splitting the two ages where necessary. I am not worried about the 65+ category since max can be blank.
I can't seem to get the syntax correct on the separate call. I have looked at the docs for ages now and I just get different errors whenever I try something. Here are some exmaples:
workingfile$`What is your age?` %>% separate(`What is your age?`, c('Min Age', 'Max Age'), "_|(?=...$) ", convert = TRUE)
workingfile %>% separate(`What is your age?`, c('Min Age', 'Max Age'), "_|(?=...$) ", convert = TRUE)
workingfile %>% separate(.$`What is your age?`, c('Min Age', 'Max Age'), "_|(?=...$) ", convert = TRUE)
the errors in order of each line tried: