xaringan | R package for creating slideshows
kandi X-RAY | xaringan Summary
kandi X-RAY | xaringan Summary
Presentation Ninja
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xaringan
xaringan Key Features
xaringan Examples and Code Snippets
Community Discussions
Trending Discussions on xaringan
QUESTION
I use xaringan to make presentations and would like to customize the CSS for the input and output R chunks.
Initially, I thought I could use the class.source
and class.output
arguments from knitr
to set the CSS classes.
ANSWER
Answered 2022-Mar-19 at 03:51These chunk options won't work for xaringan because xaringan doesn't use Pandoc's Markdown syntax but remark.js's. That is, they generate ```{.r .class}
, which only works for Pandoc's Markdown. I don't have time to support them in xaringan, but if you want to contribute a pull request on Github, here is the place to start: https://github.com/yihui/xaringan/blob/2ad2a6d/R/render.R#L195-L204 Basiscally, you wrap the source/output character strings inside .class[]
, which is remark.js's syntax for adding classes to elements.
Without a patch, you can only apply a class name to the whole output, and style the code blocks inside the class, e.g.,
QUESTION
If I print a tibble with the console in the RStudio IDE the NA values appear in red. When I print the table on a xaringan slide the table is black and white and the NA_character_ values display as . Is there a way to get the output on a xaringan slide to look like the console output (without using a screen shot)?
Here is an example:
...ANSWER
Answered 2022-Feb-07 at 00:39I tried to account for 'I didn't know what I didn't know' in regards to where your R Markdown script goes down the line (as you add more content). This works for what you have here, in addition to looking for coded negative numbers.
I have the styling called out individually. If you want to update/change these styles, you should be able to see what and where to change the styles from how this is written. I added comments to the Javascript, as well.
I used the same YAML as you have above.
I updated
example
so that it would contain a negative number. That way you can see that negative numbers will change color, as well.
QUESTION
Take the following minimal example. The numbering of the list restarts to 1 in slide 2, when I wanted that the list of slide 2 started with 2. I tried, after intensive Google search, a suggestion given at R Markdown Presentation: How to continue a numbered list across a slide? (see slide 3 and slide 4, below), but with no luck. Thanks!
...ANSWER
Answered 2022-Jan-08 at 19:27Mr. Paul, hello :)
You should remove a redundant tag
- , when using
Code:
QUESTION
When using Bookdown (HTML output), the following works perfectly:
...ANSWER
Answered 2022-Jan-05 at 16:28Try this:
QUESTION
When I include an image in a xaringan deck using knitr::include_graphics()
, my page break operator (---
) fails, and the next slide merges into the previous slide.
Here is a reprex demonstrating the problem:
...ANSWER
Answered 2022-Jan-05 at 14:22The problem is a that xaringan is very picky about what page breaks look like. In the example above, there is a whitespace after the second ---
which is causing the problem. Removing he whitespace will fix the error.
QUESTION
I know I can set a countdown
for each slide with
ANSWER
Answered 2021-Dec-02 at 12:29For the whole presentation, you may just follow Garrick Aden-Bui's answer on GitHub: https://github.com/gadenbuie/countdown/issues/14#issuecomment-559107293
Here is an example: https://bttomio.github.io/slides/25thFMM/slides.html (with files in this public repository: https://github.com/bttomio/bttomio.github.io/tree/master/slides/25thFMM)
QUESTION
I have created one function that contains two types of plots and it will give you one image. However, the title of this image will change depending on one list, so, you will have several plots but different title. (The original function will change the numbers that the plot uses but, in essence, is what I need).
This is the example that I have created.
...ANSWER
Answered 2021-Nov-19 at 08:31Although I couldn't find the way to save the plots into an object, I found a way to create a presentation with those images thanks to this post and the export
package.
QUESTION
I am making a xaringan presentation and I am trying to show my chunk options in R Markdown, and I need that it appears in a gray square.
Like this image:
But I just get my code without that nice gray square:
And of course I don't know how to put the highlights in this kind of code chunks. If somebody knows how to do it, I will really appreciate it.
This is the code I wrote in order to get the chunk without the square:
...ANSWER
Answered 2021-Nov-18 at 18:51Following the example in the "Ninja" presentation template, you can produce "raw chunks" by using the markdown
formatting with some tricks:
QUESTION
I would like to include a red border to the first xaringan slide:
This is my Rmd code:
...ANSWER
Answered 2021-Oct-13 at 00:40If you consider the title slide the first slide then:
QUESTION
I find that PNG/JPEG images in Xaringan (xaringan::moon_reader()
) html slides are visually soft and fuzzy compared to SVGs. See sample screenshots below.
In contrast, these three formats are visually comparable in standard html report (rmarkdown::html_document()
). See screenshot below.
The obvious solution was to use SVG. But, SVGs explode in size for complex figures. So, it's a bit risky to use as default in a template.
This image below for example, is 7MB as SVG while the corresponding PNG is 50kB. Having many such SVG figures can lead to the final document being hundreds of MBs in size.
Using an online tool (https://vecta.io/nano), I was able to bring the 7MB SVG down to 1.6MB (>75% reduction). Huge difference in size without obvious visual change in quality. Still far from PNG sizes.
So, some of my questions are:
Why is the PNG quality bad in xaringan? What can be done to improve it?
Are there tools/devices in R that can decrease SVG size? (simplify/flatten paths?)
Other thoughts/suggestions?
...
ANSWER
Answered 2021-Sep-11 at 15:58If I examine the images in my browser (right click on one and choose Inspect), I see that the PNG and JPEG are drawn as 432x432 pixel images, i.e. for the requested 6 inch images, it's assuming 72 dpi. My current display is a 96 dpi retina, so that looks a little fuzzy.
I can add chunk option fig.retina = 2
, and it looks much clearer. This will do the plot at 144 dpi and then shrink it to the requested size. Probably some bigger number would look even better, but it does increase the size of the output.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xaringan
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page