简体   繁体   English

加密的 R Markdown HTML 文件不显示图形?

[英]Encrypted R Markdown HTML file not displaying graphs?

I'm trying to encrypt an HTML file that I'm creating using RMarkdown.我正在尝试加密使用 RMarkdown 创建的 HTML 文件。 I'm using the encryptedRmd package.我正在使用encryptedRmd package。

For the markdown document, I have:对于 markdown 文档,我有:

title: "My_Markdown"
output: 
  html_document:
    toc: true
    toc_float: true
    toc_depth: 2
    self_contained: yes

 #ggplots below

And, converting this markdown to encrypted version:并且,将此 markdown 转换为加密版本:

library(encryptedRmd)

path = '//R_Scripts/My_Markdown.html'

encrypt_html_file(
  path,
  output_path = paste0(path, ".enc.html")
)

The encryption works, and I can access the new encrypted HTML.加密有效,我可以访问新的加密 HTML。 However, none of the ggplots show up in the encrypted version, nor does the table of contents.但是,加密版本中没有显示任何 ggplot,目录也没有显示。 Tables with data do show up.带有数据的表格确实出现了。 The test.html document has ggplots that appear, so I'm wondering why it's not translating to the encrypted version? test.html 文档出现了ggplots,所以我想知道为什么它没有翻译成加密版本?

I have not heard of encryptRmd package, but looks interesting.我没有听说过 encryptRmd package,但看起来很有趣。 when creating the.Rmd, what if you used self_contained: yes in the yaml?在创建.Rmd 时,如果在 yaml 中使用self_contained: yes会怎样? This will render the entire document to be self contained, hoping it will have good results for you这将使整个文档成为独立的,希望它对您有好的结果

output:
  html_document:
    self_contained: yes

I just tried it both ways and I was able to get the ggplot2 to display in both ways.我只是尝试了两种方式,我能够让 ggplot2 以两种方式显示。

encrypt_html_file("//R_Scripts/test.html", "//R_Scripts/test_enc.html"))

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

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