creativesetr.blogg.se

Change image size rmarkdown presentation
Change image size rmarkdown presentation












change image size rmarkdown presentation
  1. #Change image size rmarkdown presentation how to#
  2. #Change image size rmarkdown presentation code#

Making presentations with xaringan isn’t just a cool trick. They can, for example, increase the text size or use screen readers. As Canelón put it to me, “when have the HTML version of the slides, they have some control over what it looks like.” People with limited vision are able to access HTML documents in ways that are accessible to them. The third benefit of using xaringan is accessibility. Just share the link to your slides and you’re done. No need to email or print out your slides for your viewers.

change image size rmarkdown presentation

Second, because xaringan creates slides as HTML documents, you can post them online (we’ll discuss ways to do this in Chapter 10).

change image size rmarkdown presentation

#Change image size rmarkdown presentation code#

You can now reuse your code from that R Markdown document and use it to make figures, tables, and more in your xaringan slides. Say you’ve written a report that you’ve knitted to a Word document. In my conversation with Silvia Canelón, she brought up three main reasons.įirst, if you’re already working in R and R Markdown, being able to produce slides in the same tool is a game changer.

#Change image size rmarkdown presentation how to#

Now that we’ve discussed how to use xaringan, let’s talk a bit about why you might consider switching to it for your presentations. In Conclusion: The Advantages of xaringan This code tells xaringan to use the default CSS as well as customizations made in the metropolis and metropolis-fonts CSS files (these come bundled with xaringan so you don’t need to do anything beyond installing the package to access them). To use the theme, you adjust your YAML as follows. You can then choose a theme you’d like to use. remark-slide-content before the h2 in order to make sure we target the specific element in our presentation (remark comes from remark.js, a JavaScript library to make presentations that xaringan uses under the hood).ĭoing this will show the following output: #> "chocolate-fonts" "chocolate" I can then add CSS like this to tell R Markdown to make the h2 (the second-level header) 150px and white. To tell R Markdown that this code chunk contains CSS, not R, I put the text “css” in between the curly brackets. To add custom CSS, I’m going to create a code chunk. You just have to know a bit of CSS to make tweaks to your slides. If you’re thinking, “I’m reading this book to learn R, not CSS,” don’t worry. To do this, we need to use some CSS, the language used to style HTML documents (remember, when we knit our xaringan presentation, we end up with an HTML document). One issue with the slide we just made is that it’s hard to read the word “Penguins.” It would probably be best if we could make the text bigger and a different color. If I open up the HTML document, I see Figure 9.3. When I hit Knit, I get an HTML file with the same name as R Markdown document (in my case, xaringan-example.Rmd and xaringan-example.html). Let’s try hitting the Knit button to see what it looks like. With this change, we will now get slides rather than a Word document. Instead of output: word_document we now have output: xaringan::moon_reader. This code should look familiar because it is exactly the same as the R Markdown document we created in Chapter 7 with one line changed in the YAML. The average bill length is `r average_bill_length` millimeters. title: "Penguins Report" author: "David Keyes" date: "" output: xaringan::moon_reader - ``` average_bill_length % summarize(avg_bill_length = mean(bill_length_mm, na.rm = TRUE)) %>% pull(avg_bill_length) ``` The chart shows the distribution of bill lengths. As you’ll hear in this chapter, these benefits include, but also go well beyond, making good-looking slides. Canelón has done extensive teaching on the xaringan package and has thought deeply about its benefits. To learn more about the capabilities of xaringan, I spoke with Silvia Canelón, a data analyst in the Urban Health Lab at the University of Pennsylvania. This package, which uses R Markdown to make presentations, is one of several you can use to make slides, but it is the most widely used. In this chapter, we’ll learn how to make presentations in R using the xaringan package. Do you need to do your analysis, data visualization, and table making in R and then copy everything to PowerPoint by hand? No! R has robust presentation-making capabilities. You may be wondering at this point if creating presentations will require us to add another tool, like PowerPoint. In Chapter 7, we talked about the R Markdown-based workflow having the benefit of keeping everything in one tool. Reporting happens in presentations as often as it does in Word-based reports. Remember how we talked in Chapter 7 about the multi-tool workflow from SPSS to Excel to Word? That leaves out one of the most common tools in many people’s workflow: PowerPoint. 9 Create Beautiful Presentations with R Markdown














Change image size rmarkdown presentation