在r中的特定文件中保存pdf打印
我创建了多个保存在列表中的绘图。 现在我想保存他们,保留他们在列表中的名字。 到目前为止,我的代码如下在r中的特定文件中保存pdf打印,r,pdf,plot,R,Pdf,Plot,我创建了多个保存在列表中的绘图。 现在我想保存他们,保留他们在列表中的名字。 到目前为止,我的代码如下 pdfplots <- function(PlotList){ L <- List() for (i in 1:length(L)){ names(L[[i]]) <- paste0(names(PlotList), i) pdfPath <- (file = "~/Documents/MyFile/MyPlots, names(L[[i]]
pdfplots <- function(PlotList){
L <- List()
for (i in 1:length(L)){
names(L[[i]]) <- paste0(names(PlotList), i)
pdfPath <- (file = "~/Documents/MyFile/MyPlots, names(L[[i]])")
myplot <- boxplot(PlotList[[i]])
}
dev.off()
}
pdfplots您应该使用pdf
函数。下面的区块应该正在执行此任务:
pdfplots <- function(PlotList){
for (i in 1:length(PlotList)){
fullFileName = paste0("~/Documents/MyFile/MyPlots/", names(PlotList)[i],".pdf")
pdf(fullFileName)
boxplot(PlotList[[i]])
dev.off()
}
}
pdfplots1。在pdfPath
行中,引号位于错误的位置。2. <缺少代码>pdf()
命令。3.使用lappy
循环浏览列表。