I have a dataset that contains multiple variables within one column. I am trying to figure out how to extract the variables (6 unique questions) from column 'question' with their associated value in percentage of respondents. When I pivot wider, it doesn't return the results I need (image attached
)
My ideal output is a mean percentage of respondents, grouped by country and sex for each question.
ie an output that has Country: Afghanistan, year, mean percentage of respondents per question.
dff2 <- df2 %>% pivot_wider(names_from = 'Question', values_from = 'Percentage of respondents')
thank-you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.