Rmd: Make the figure larger when clicked on it - r

I have a Rmarkdown file where I include figures with
knitr::include_graphics
The figures show up in the knitted document nicely. However, when I'm reading the knitted document, if I want to focus on one figure, I use the zoom option of the browser, which is not ideal.
Is it possible to add open the figure in a larger window when clicked on it?
PS: I use gitbook and/or bookdown::html for the output format of my Rmd files.

You can try out the themes from rmdformats package which implement this feature. They call it lightbox. To enable,you just need to set lightbox to true in the RMD yaml.
Example:
---
title: "My document"
output:
rmdformats::downcute:
lightbox: true
---

Related

R markdown landscape-only word document

I am trying to knit an .Rmd file to a word document that is entirely in landscape format.
Based on this post, I have tried using a reference doc. I created a Word document, changed the layout to landscape and saved it in the same folder as the .Rmd. However, this doesn't seem to work for me. Maybe I am missing something and saving a file in landscape format is not enough?
Previously, I was using the HTML comments/tags <!---BLOCK_LANDSCAPE_START---> and <!---BLOCK_LANDSCAPE_STOP---> from {officedown}, but since those can only be placed before and after code chunks, the title of the document would end up on a separate page that is portrait. Also, it gives a last page that is blank and portrait and that I don't know how to get rid of.
The current YAML header looks as follows:
---
title: "Summary Report"
output:
officedown::rdocx_document:
reference_docx: landscape_template.docx
---
I am also sure that the reference file is used because I get a warning in the console about not having set a Figure style:
Warning message:
paragraph style for plots "Figure" has not been found in the reference_docx document. Style 'Normal' will be used instead.
Does anyone have any suggestions on what I am missing?
After reaching out to the developer of {officedown} on GitHub, here is the very simple solution to the problem:
YAML header of .Rmd file:
---
output:
officedown::rdocx_document:
page_size:
orient: "landscape"
---

IN R MARKDOWN, How Can I add a background image (HTML output)?

I'm trying to put an image as background for my R markdown document (HTML output) Instead of the black background. I Was searching everywhere in the documentation on how to do this but I can't seem to find any answer as it's my first time working with R Markdown.
I can't seem to know how to put the background image and how to divide it that way so I can have my content in the middle
I'm also trying to attach a Hyperlink to tablist option,in the Picture2 as you can see "Source" as for when I click on it, it directs me to an external page
but ## [Source] ("github.com/example") isn't working which was the syntax in the documentation.
this is my code till now ..
I hope you can help me with these two questions,
it's again : - How to set a background image to an HTML output on the whole page like the black background
and how can I make the click on " Source " or TabItem directs me to an external link?
Thank you
---
title: "Title"
author: "Nessy"
date: "2 3 2020"
output:
rmarkdown::html_document:
theme: lumen
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# {.tabset .tabset-fade}
## Analysis
## Source
Just posting the answers here so it can be marked as "answered." (Kindly mark this as answer when you're done and if this satisfies you).
1) Regarding background theme check this out: https://rpubs.com/thaufas/555157
2) Try [github](someurl) with no space in between. EDIT:
Regarding opening the link in markdown there try these links R Markdown - Hyperlink outside Rmd file or Linking to url with rmarkdown using Knit Word in Rstudio.

How to convert R reveal.js presentation to pdf?

I made a presentation in R, using one of the reveal.js templates (using revealjs R package).
By default, its generating a html file and when opened for presentation it displays top part of the browser including bookmarks, filepath etc... I can turn off bookmarks bar but not the filepath part, I need to present this in a formal setting so exporting the presentation to pdf seems like a better option.
Does anyone know how to export it to pdf? Can I add anything in the YAML header so that the output will be pdf and not html?
Below is the sample code, it generates "test.html" file. I want to generate "test.pdf" while preserving all other properties of presentations e.g transitions, interactive plots etc...
---
title: "test"
output: revealjs::revealjs_presentation
---
## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```
## Slide with Plot
```{r, echo=FALSE}
plot(cars)
```
If a manual solution is OK for you (no automatic generation of PDFs when you knit):
Open your HTML file in the browser and add ?print-pdf to the URL, e. g.
http://index.html?print-pdf
You can then print the slides into PDF (e. g. with Ubuntu Linux + Firefox + "save to file" printing option).
you may use decktape to convert various HTML presentations to pdf
https://github.com/astefanutti/decktape
The links inside the presentation will be preserved, yet the presentation will not be interactive
If you just need to hide the browser interface while preserving interactivity, use fullscreen mode
e.g. in google chrome press F11
I know this is 3 years late, but why not just put Chrome in fullscreen view?

outline/toc on the left and contents on the right layout using rmarkdown

I was checking out how to include a nice table of contents / document outline in my rmarkdown document (with html output).
Well, the "standard" approach:
html_document:
toc: true
It works, but I do not like it (not even tweaking options and themes).
But actually, in several pages of the documentation (e.g. http://rmarkdown.rstudio.com/html_document_format.html), they use a very nice layout that includes a table of contents / document outline to the left of the page and the contents of the right (and the outline syncs with the contents part, Highlighting where on the contents you currenly are).
This is EXACTLY what I want. And I guess they did it using rmarkdown. But I cannot find how to do it.
I've check that documentation page, as well as rmarkdown gallery, flex dashboard, web sites among others. But I can't seem to figure it out how to do it.
Well, using web sites I would be able to do it, but it seems overly complicated for what I want (you need to have several pages, and at least index.Rmd file and the _site.yml file).
Instead, I guess there should be an option to simply tell rmarkdown to take my single document and put the section headers in a nice frame to the left, as in the example page from RStudio.
Have you tried this approach? It works for me and it's also on the homepage, you provided:
---
title: "Untitled"
output:
html_document:
toc: true
toc_float: true
---
# header 1
# header 2
# header 3
With a little bit of text, it looks like that:

how to remove the title slide from Rstudio ioslides presentation

I am using R Studio and R Markdown to create an ioslides presentation. I would like to eliminate the title slide, and begin the presentation with a normal slide. So far, I have tried removing the title from the YAML options, but this just results in a blank title page.
How can I remove the title page altogether?
my YAML options
---
output:
ioslides_presentation:
widescreen: true
---
You can try to customise the template file. You can find the path of the default one in your system by typing rmarkdown:::rmarkdown_system_file("rmd/ioslides/default.html") in the console.
The easiest way to play with it would be to copy it to the directory of your project, rename it and put additional YAML option like template: custom_template.html. Even though this might not be enough to remove the title slide completely, you can always customise it so it looks like the first slide of your presentation.

Resources