Hi! I have a "check all that apply" question and am looking to sort the answers into specific columns. I saw the post that uses seperate_row but I would like to maintain the rows as they are. I have provided a working example below.
Students <- c(001, 002, 003)
Answer_1 <- c( "Understanding spatial relationships;Understanding text;Remembering yesterday's lessons ")
Answer_2 <- c("Understanding text;Remembering yesterdays lesson")
Answer_3 <- c("None of the above")
Answers <- c(Answer_1, Answer_2, Answer_3)
student_data <- tibble (Students, Answers )
# A tibble: 3 × 2
# Students Answers
# <dbl> <chr>
# 1 "Understanding spatial relationships;Understanding text;Remembering …
# 2 "Understanding text;Remembering yesterdays lesson"
# 3 "None of the above"
## The tibble below I need to extract the answers into appropriate column headers
## for instance:
## "Understanding spatial relationships" needs to be in a column titled "Skill_1"
## "Understanding text" in a column titled "Skill_2"
## "Remembering yesterdays lesson" in a column titled "Skill_3"
## "None of the above" in a column titled "Skill_4"
## but when I use seperate I get:
student_data_seperate <- student_data %>% separate(Answers, c("Skill_1", "Skill_2", "Skill_3", "Skill_4"), sep = ";")
student_data_seperate
# A tibble: 3 × 5
## Students Skill_1 Skill_2 Skill_3 Skill_4
# <dbl> <chr> <chr> <chr> <chr>
# 1 Understanding spatial relationships Understanding text "Remembering yesterday's … NA
# 2 Understanding text Remembering yesterdays lesson NA NA
# 3 None of the above NA NA NA
## When I print seperate splits the information in the order it comes, I'd like to be able to
## flag that specific text belongs in a specific column OR take this result and reconfigure the
### the answers to the correct columns - which ever is best s
student_data_seperate