我有两种类型的数据,我想进行成对比较:假(控件)和测量,
sham1 <- c('Sham1.r1', 'Sham1.r2', 'Sham1.r3')
sham2 <- c('Sham2.r1', 'Sham2.r2', 'Sham2.r3')
shams <- list(sham1, sham2)
day14 <- c('T14d.r1', 'T14d.r2', 'T14d.r3')
day90 <- c('T90d.r1', 'T90d.r2', 'T90d.r3')
measurements <- list(hour4, day1, day3, day7, day14, day90)
我想得到以下内容:
(('Sham1.r1', 'Sham1.r2', 'Sham1.r3'), ('T14d.r1', 'T14d.r2', 'T14d.r3')), (('Sham1.r1', 'Sham1.r2', 'Sham1.r3'), ('T90d.r1', 'T90d.r2', 'T90d.r3')), (('Sham2.r1', 'Sham2.r2', 'Sham2.r3'), ('T14d.r1', 'T14d.r2', 'T14d.r3')), (('Sham2.r1', 'Sham2.r2', 'Sham2.r3'), ('T90d.r1', 'T90d.r2', 'T90d.r3'))
我想要的是:
list(list(c("Sham1.r1", "Sham1.r2", "Sham1.r3"), c("T14d.r1",
"T14d.r2", "T14d.r3")), list(c("Sham1.r1", "Sham1.r2", "Sham1.r3"
), c("T90d.r1", "T90d.r2", "T90d.r3")), list(c("Sham2.r1", "Sham2.r2",
"Sham2.r3"), c("T14d.r1", "T14d.r2", "T14d.r3")), list(c("Sham2.r1",
"Sham2.r2", "Sham2.r3"), c("T90d.r1", "T90d.r2", "T90d.r3")))
答案 0 :(得分:5)
apply(expand.grid(shams, measurements), 1, unname)