We can use pivot_longer
library(dplyr)
library(tidyr) # 1.0.0
df1 %>%
pivot_longer(cols = matches("^Q\\d+_\\d+"), values_to = 'Q1') %>%
select(-name)
4
solved Surveydata Package Question, merge columns [closed]
We can use pivot_longer
library(dplyr)
library(tidyr) # 1.0.0
df1 %>%
pivot_longer(cols = matches("^Q\\d+_\\d+"), values_to = 'Q1') %>%
select(-name)
4
solved Surveydata Package Question, merge columns [closed]