Reduce file size of R Markdown HTML output

前端 未结 3 1137
滥情空心
滥情空心 2020-12-11 02:30

If I create a very basic R Markdown file with no images or code and knit this HTML, I end up with an outputted file size that is more than 700kb in size. Is there any way to

3条回答
  •  -上瘾入骨i
    2020-12-11 03:21

    The html_vignette format is perfect if you want a smaller file size. As described in the function documentation:

    A HTML vignette is a lightweight alternative to html_document suitable for inclusion in packages to be released to CRAN. It reduces the size of a basic vignette from 100k to around 10k.

    For your example:

    ---
    title: "Hello world!"
    output: rmarkdown::html_vignette
    ---
    
    Nothing else to say, really.
    

    Results in an output of 6kB:

    You can read more about the package in the online documentation here.

提交回复
热议问题