admin管理员组文章数量:1346028
I am building a small R package that will render an rmarkdown
document, however, I don't know where to save my rmd
so that it can be ran and displayed from a function inside the package. I got this small function below:
#' @title shiny app to print automated document
#' @import shiny rmarkdown utils
#' @return shiny app for documents. Type 'doc()' to launch doc.
#' @name doc
#' @examples
#' doc()
#' browseURL("sample.pdf")
#'
#' @export
#'
doc <- function() {
library(shiny)
library(rmarkdown)
rmarkdown::render("sample.rmd"),
output_file = "sample.pdf")
}
The sample.rmd file is:
---
title: "sample"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document.
I don't want to use system.file()
as input inside render
because I want the output to be saved on a file within my project directory and not under the R library directory. Let me know if is not clear and I can elaborate a bit more.
本文标签: shinyWhat folder to use to place rmd files when building an R packageStack Overflow
版权声明:本文标题:shiny - What folder to use to place rmd files when building an R package - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743821273a2544830.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论