我试图获取列表的索引,例如set_of_paragraphs("Two sample t-test",list_new2[[1]], list_new2[[2]],list_new2[[3]],list_new2[[4]])
...等等。如何获取列表索引的向量R
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_of_paragraphs
工作
set_of_paragraphs("Two sample t-test",list_new2[[1]], list_new2[[2]],list_new2[[3]],list_new2[[4]])
我尝试做这种方式,set_of_paragraphs
给了我错误
Error in set_of_paragraphs(l, list_new2) : set_of_paragraphs can only contains pot objects.
l <- list("Two sample t-test")
set_of_paragraphs(l,list_new2)
因此,我最好的方法是将它们全部列入代码set_of_paragraphs("Two sample t-test",list_new2[[1]], list_new2[[2]],list_new2[[3]],list_new2[[4]])
,但问题是,我有这么多,有什么办法可以写循环或者申请访问索引。
是的,它完美的作品 – BIN