0

I am not sure where the problem is so will describe it as much as I can. I am aware of this question, but not sure it applies to my case (Reduce file size of R Markdown HTML output)

I am generating an R html_notebook in a cluster and compared the output size with a one generated on a local machine. The one on a cluster comes always at 5 to 6 time more in size than the one generated on a local machine. For example, in one case, the size on a local machine is 16 Mb but the one from the cluster is at 76 Mb! I have a few long rmarkdown files to generate and wondered from where the issue comes.

Here are the specs of both machines:

  1. Local machine: windows 10, R version 4.0.2 (same with version 4), 64bit, RStudio version 1.3.959; rmarkdown: 2.3; Pandoc version 2.7.1.
  2. Cluster: CentOS Linux 7, Version 3.28.2, accessed via an HPC cluster. R version (4 cannot upgrade), 64bits, RStudio version 1.3.959; rmarkdown: 2.3; Pandoc version 2.7.1.

I tried with R 4 in both local and cluster, and same results.

In notebook, this is the part in the YAML: output: html_notebook: number_sections: true toc: true toc_depth: 6 toc_float: collapsed: true

I tried with an html_document and the same happened. I am generating the notebook as follows:

  1. Local machine: Opened in Rstudio, ran the code, then Knit, then save (haven't changed any settings)
  2. Cluster: ran following command: Rscript -e "rmarkdown::render('name.Rmd', clean=TRUE)"

I prefer to run on cluster as this is much quicker (2 hours in cluster with 44 cores; 24 hours or more on local machine :()

on local machine, png is used and on cluster it is svg files. But I am using plotly, and can save outputs as png.

Any suggestions?

Thanks and sorry for the long post

2
  • I tested a few points and found the solution myself.. sorry for this. It is related to using png (from the cairo package) and also the way rstudio was compiled on the cluster. I used the non-java compiled version. Ran the model and the outcome is as expected (i.e., 5 times less in size.) Commented Jul 16, 2020 at 15:49
  • in addition, using an html_document instead of an html_notebook seems to reduce the size massively Commented Jul 16, 2020 at 15:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.