Displaying figures from RMarkdown with github_document output - r

I am trying to display figures on github from RMarkdown without success.
The figure is displayed on the local html preview.
After pushing on Github the md file the figure is not displayed.
title: "Untitled"
output: github_document
summary(cars)
plot(pressure)

Need to push the images files containing figures too.

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"
---

Rmd: Make the figure larger when clicked on it

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
---

When knitting an Rmd file to pdf, hashtags in links to bookdown books are converted to %23 and don't work

When I knit the following Rmd file to pdf, the # in the link to the bookdown book is converted to %23 and doesn't work. The link works fine if the Rmd is knitted to html instead of pdf.
I tried escaping the # with \ and \\; neither worked.
---
output: pdf_document
urlcolor: blue
---
This link does not work in the rendered pdf:
https://bookdown.org/yihui/bookdown/markdown-syntax.html#inline-formatting
Is there any way to get such a link to work in a rendered pdf document?
As per the comments, it's an issue with the PDF Viewer.
Reference: https://tex.stackexchange.com/questions/555559/href-broken-links-due-to-url-encoding-hash-sign-23

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.

Export to PDF using rmarkdown render without PDF navigation buttons

I am using the render function from rmarkdown to export a .Rmd file to PDF.
The .Rmd file is the template generated within RStudio using
New File > R Markdown > Presentation > PDF (Beamer)
When export to PDF, each PDF page has navigation buttons at the bottom of the page which I would like to exclude during the export process. Below are the buttons.
Does anyone know how to exclude these navigation buttons?
You can add a command to turn them off in your header:
---
title: "Untitled"
output: beamer_presentation
header-includes:
- \beamertemplatenavigationsymbolsempty
---

Resources