5
收集多组列
我有一项在线调查的数据,其中受访者会经历1-3次问题循环。调查软件(Qualtrics)记录在多列,也就是说这个数据,Q3.2的调查将在列Q3.2.1.,Q3.2.2.以及Q3.2.3.: df <- data.frame( id = 1:10, time = as.Date('2009-01-01') + 0:9, Q3.2.1. = rnorm(10, 0, 1), Q3.2.2. = rnorm(10, 0, 1), Q3.2.3. = rnorm(10, 0, 1), Q3.3.1. = rnorm(10, 0, 1), Q3.3.2. = rnorm(10, 0, 1), Q3.3.3. = rnorm(10, 0, 1) ) # Sample data id time Q3.2.1. Q3.2.2. …