Figures or plots with accompanying thumbnails, like in RStudio - r

When I create plots within a single chunk of an R-Studio markdown file, they appear in a nice array with clickable thumbnails:
However, when I publish as an HTML file, these figures are simply displayed vertically, one after the other. Is there any way to achieve the way that it originally looks in RStudio?

Unfortunately there's no way to output what RStudio shows you, but you can do this and a lot of other HTML formatting yourself using the knitrBootstrap package.
Check out the end of this example for a clickable-thumbnail example.

Related

kable table not correctly displayed on github

I am working on a color package for the company I work for. It contains a table to see the color of the company in an interactive way, with the actual color under the hex code (see picture below).
This works fine as long as I compile my rmd locally. However, when the file is compiled on Github, the underlying color disappears (see https://github.com/qwertzlbry/bsscol or picture below).
Does anyone know why Github is not displaying my table correctly?
The entire rmd file including all codes can be found at https://github.com/qwertzlbry/bsscol, any help on this topic is greatly appreciated.
It appears the differences are due to two different renders. From what I can see, kable_paper outputs a Markdown text-document. When you are viewing it, something is rendering it into HTML, where the <span>-tag is allowed.
In the second screenshot, on GitHub, it is GitHub that is rendering the Markdown document into HTML. Alas, the GitHub Flavored Markdown does not support the <span> tag. So it simply ignores it.

In RStudio display Images inline in Rmarkdown files?

I am new in R and getting output(images/ interactive plots) displayed by some packages in viewer pane. I would rather like them to be displayed in the ramrkdown notebook.
Here is an example, using magick::image_read() which displays image in viewer pane and not inline:
Reference link where a knitted document has produced images within the notebook using same package as I have used: https://cran.r-project.org/web/packages/magick/vignettes/intro.html
Below are the settings I am using:
Have asked similar question on keras package earlier How to make plots appear in Rmarkdown file instead of viewer pane when working with keras in Rstudio?
This is happening with some of the packages, how do I make these images/plots appear inline ?

Controlling the size of the HTML file when saving file

can someone help me to resize an HTML file produce with plotly in Jupyter?
This is the code I am using to save to an HTML file:
fig.write_html("D:\jupyter\image.html")
It works but now I want to control for the size. Here (https://plotly.com/python/interactive-html-export/) is suggested how to do it but I cannot get my head around to how specifically write the code to not get a big image
If you type fig.write_html? inside a cell you can read all the documentation, which is a little more explicit than the document you posted. In short
fig.write_html("output.html",
include_plotlyjs="cdn")
Should produce a file ~3MB smaller than the one you are getting now as this option point to the plotly.js online instead of include it on the output.

Add a separate table of content in a HTML bookdown output

I created a website using bookdown package and I have a nice table of content on the left, which is fine.
But now I would like to add the same table of content in a separate chapter (while keeping the toc on the left). I am looking to something somehow similar to what I can do in Latex when using \tableofcontent and be able to put the table of content whenever I want in any section. Is there a simple way to do so, without having to manually copy paste content from the html output?
Maybe I am not using the right keywords but I can't find any suggestions on how to do it.

Can I add pdf tags to R markdown document?

I am trying to make a "accessible" or 508 compliant PDF using R markdown. To do this I need to have pdf tags attached to figure that provide alternative text. I also need to be able to add tags to section headers etc.
The idea is if you open the pdf in a pdf viewer that then the tags are read in in the "table of context" and allow a user to move between sections.
If you use a markdown header like
# header
R markdown seems to add a label to this so it appear in the table of context. I would like to be able to add these kind of labels manually as well.
Does anyone have any ideas of how to do this?
You should be able to achieve this using pandoc formatting (see http://pandoc.org/MANUAL.html), for example the alt text for an image can be specified as ![alt text or image title](path/to/image)

Resources