Sharon MachlisĪn HTML slide presentation lets you interact with visualizations, such as hovering over a graph to see underlying data. You can hover over lines on the graphs in these slides to see underlying data, as well as click legend items to turn lines off and on. The body of the file includes a graphing function I wrote using one of my favorite dataviz packages, echarts4r, to visualize my weather data. The xaringan::moonreader output option regenerates the slides each time you save the file so you don’t need to click the knit button. layout: true means “this is a slide setting up layout defaults.” class: center centers everything – header text, graphics – unless I specifically code it otherwise. That first slide after the title slide won’t display it’s setting defaults for the other slides. title: "National Weather Service Temperature Forecasts" subtitle: "Boston, San Francisco, and Honolulu" author: "Sharon Machlis" date: "`r format(Sys.Date(), '%B %e, %Y')`" output: powerpoint_presentation: reference_doc: CorporateStyle.pptx - ``` get_interactive_graph(hi_data) ``` - # () Here is an R Markdown file that’s a bit more interesting than the default doc, at least for me: One with weather data. Make sure the three dashes are on a completely new line. That’s done in the doc’s YAML header with the slide_level option, such as output: powerpoint_presentation: slide_level: 3īut if you don’t want to fiddle with all that, you can divide content into new slides manually with three dashes. You can specify another headline level to auto-divide your document into new slides. You don’t need to use that default rule, though. How did R know where to break the content into new slides? The default is “the highest level of headline that’s not followed immediately by another headline.” In this case that’s headline level two, or all titles starting with #. If you save that file and then “knit” it by clicking the knit button in RStudio, you'll get a PowerPoint presentation with the same information. The resulting R Markdown file created by RStudio includes examples for mixing text and R code results. If you click on the second choice, Presentation, you should see an option for PowerPoint under Default Output Format. If you do that from RStudio’s menu with File > New File > R Markdown, you’ll have a few choices. There is an option to create a PowerPoint file from R Markdown when you create a new markdown file in RStudio. If your pandoc is too old, try updating RStudio (or install pandoc directly from ). You can run the rmarkdown package’s pandoc_version() function to see if you’ve got it installed and, if so, what version. RStudio ships with Pandoc, so you probably have a version of it installed if you use RStudio. It’s not R at all it’s a separate piece of open source software designed for file format conversions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |