簡體   English   中英

How to create a R markdown file and append a string variable to the R Markdown document

[英]How to create a R markdown file and append a string variable to the R Markdown document

I am running a shiny application from which I want to create a R markdown file and append a string of characters to the R Markdown document

rmd_content <- paste0("```Your R markdown string content",string_variable,"```")

rcon <- file("markdown_file.Rmd", "w") # Create Rmarkdown file
cat(rmd_content, file = rcon) # Write your content to Rmarkdown file
close(rcon)

在此 R 代碼之后,您應該在當前工作目錄中有一個名為“markdown_file.Rmd”的文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM