简体   繁体   English

编织多个html文件rstudio

[英]knitting multiple html files rstudio

I have a chunk of code that I want to run on multiple data files. 我有一大堆要在多个数据文件上运行的代码。 For example I want summary statistics of all the data files. 例如,我想要所有数据文件的摘要统计信息。 For each file, I need a separate HTML file (knit html). 对于每个文件,我需要一个单独的HTML文件(编织html)。 Is there a way to run the code on all the files producing separate HTML files for each data file respectively, apart from running the code on each file individually and then knitting and then "saving as" on RStudio?? 除了在RStudio上分别运行每个代码然后编织然后“另存为”之外,是否有一种方法可以在所有文件上运行代码,分别为每个数据文件生成单独的HTML文件?

Here is an example of code I want to run on each file: 这是我要在每个文件上运行的代码示例:

summary(myData$ZScoreA)

boxplot(myData$ZScoreA, myData$ZScoreB, main="ZScores", xlab="Group", ylab="ZScore value", names=c("A","B"))

plot(myData$ZScoreA)

library(ggplot2)

qplot(ZScoreA, data=myData)

To me it sounds like you should write your code using a function. 对我来说,听起来应该使用一个函数编写代码。

yourfunction <- (yourdata) {summary(yourdata$ZScoreA)
boxplot(yourdata$ZScoreA, yourdata$ZScoreB, main="ZScores", xlab="Group", ylab="ZScorevalue", names=c("A","B"))
plot(yourdata$ZScoreA)
library(ggplot2)
qplot(ZScoreA, data=yourdata)
}

Call you function on all your data 调用您所有数据的函数

yourfunction(yourdata1)
yourfunction(yourdata2)
yourfunction(yourdata3)

Brew looks likes it can help you write the data from yourfunction to html. Brew看起来可以帮助您将数据从函数写入html。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM