【问题标题】:How to create a R markdown file and append a string variable to the R Markdown document如何创建 R Markdown 文件并将字符串变量附加到 R Markdown 文档
【发布时间】:2021-06-14 13:47:20
【问题描述】:

我正在运行一个闪亮的应用程序,我想从中创建一个 R Markdown 文件并将一串字符附加到 R Markdown 文档

【问题讨论】:

    标签: r shiny shinyapps


    【解决方案1】:
    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”的文件

    【讨论】:

    猜你喜欢
    • 2019-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多