R中列表索引向量的求法

R中列表索引向量的求法,r,for-loop,apply,R,For Loop,Apply,我尝试获取列表的索引,例如段落集(“两样本t检验”,列表新2[[1]],列表新2[[2]],列表新2[[3]],列表新2[[4]])…等等 library(ReporteRs) list_new <- c("Text1","Text2","String","Another Text") my_text <- letters[1:length(list_new)] list_new1 <- paste0(my_text, list_new,sep="") list_new2 &l

我尝试获取列表的索引,例如
段落集(“两样本t检验”,列表新2[[1]],列表新2[[2]],列表新2[[3]],列表新2[[4]])
…等等

library(ReporteRs)
list_new <- c("Text1","Text2","String","Another Text")
my_text <- letters[1:length(list_new)]
list_new1 <- paste0(my_text, list_new,sep="")
list_new2 <- lapply(list_new1, function(i) pot(substr(i,1,1),textProperties(color="blue",vertical.align="superscript"))+substring(i,2))
我试着这样做,
set\u\u段
给了我错误

段落集合中的错误(l,列表2): 段落集只能包含pot对象。

l <- list("Two sample t-test")
set_of_paragraphs(l,list_new2)

l如果要使用参数列表调用函数,可以使用
do.call
。试一试

l <- list("Two sample t-test")
do.call("set_of_paragraphs" c(l, list_new2))
(我无法测试,因为该包似乎需要Java,而我没有安装)。基本上,您将所有参数放入一个大列表中(这里我使用
c()
连接两个列表)

l <- list("Two sample t-test")
do.call("set_of_paragraphs" c(l, list_new2))
set_of_paragraphs(l[[1], list_new2[[1]], list_new2[[2]], list_new2[[3]], ...)