如何使用Excel中的参数列表自动生成多个RMD文件?
我希望你一切都好,我告诉你我的问题。我有一个以.RMD格式使用的仪表板,可与Shiny and FlexDashboard一起使用,当我在仪表板内更改参数时,就会生成全新的。
我想做的是使用我在Excel中拥有的某些标识符自动生成300个仪表板,这将是.rmd文件的参数。
有人对如何解决这个问题有近似值吗?
我留下一个图像,红色圆圈中包含的内容是要更改的参数。
I hope you are well, I tell you my problem. I have a dashboard in .RMD format that works with Shiny and Flexdashboard and when I change a parameter inside the dashboard a completely new one is generated.
What I want to do is to automatically generate 300 dashboards with some identifiers that I have in Excel, which would be the parameters of the .RMD file.
Does anyone have an approximation of how to solve this?
I leave an image, what is enclosed in red circles are the parameters to be changed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将这些“标识符”的占位符添加为
params
在您的YAML标题中,然后从Excel中读取它们,然后循环通过它们,将它们传递到您的.rmd
使用params
rmarkDown :: Render()
和purr :: map()
中的参数。因此,您可以添加YAML:
然后您可以编写这样的渲染函数
,并传递您从Excel读取的“标识符”的向量,它可能类似于以下内容:
params_list< - c(“ dissideifier1”,“” dissideifier2”,“ dissideifier3”)
,然后调用列表中每个“标识符”或“ param”的渲染函数,从excel:
purrr :: map(params_list,render_func)
>You can add placeholders for these "identifiers" as
params
in your YAML header, then read them from Excel into R and then cycle through them, passing them to your.Rmd
using theparams
argument inrmarkdown::render()
andpurr::map()
.So to your YAML you would add:
and then you could write a render function like this
and pass the vector of "identifiers" you read in from excel which might resemble this:
params_list <- c("identifier1", "identifier2", "identifier3")
and then call your render function for each "identifier" or "param" in your list read in from Excel:
purrr::map(params_list, render_func)