Spatial Ecology & R
  • Research & Training
  • R Code & Data
  • Other Resources

Spatial Ecology & R
(search via "category" below)

 

11/18/2015

0 Comments

 

Making presentations with RMarkdown

Emily Dolson

10/29/2015

Do you like RMarkdown so much that you wish you could use it to make presentations too? There’s a really cool library called slidify that will let you do just that! First, we install it:

require(devtools)
install_github("ramnathv/slidify") #Slidify isn't on CRAN, the normal R package manager, so we have to get it directly from Github. Sometimes this doesn't go as smoothly on Windows, but don't worry, the internet can help!
install_github("ramnathv/slidifyLibraries")
library(slidify)

Now that we have slidify installed, let’s make a presentation:

author("example_presentation")

The author function will create a new directory on your computer (inside the current working directory) with the specified name. This is where slidify will store all of the information associated with your presentation. This command will also open up a template slidify presentation markdown document, index.Rmd. To make your presentation, fill in that document. There’s a lot going on, but you don’t need to worry about most of it for now. Just fill in the title, subtitle, author (and your job, if you want) and don’t worry about the rest. Here’s an example:

title       : Demonstration of using Slidify
subtitle    : It's really cool!
author      : Emily Dolson
job         : Grad student at MSU
framework   : io2012        # {io2012, html5slides, shower, dzslides, ...}
highlighter : highlight.js  # {highlight.js, prettify, highlight}
hitheme     : tomorrow      # 
widgets     : []            # {mathjax, quiz, bootstrap}
mode        : selfcontained # {standalone, draft}
knit        : slidify::knit2slides

Now you’re ready to start making the slides! Scroll down past the header information, and you should see one example slide, which you can delete the contents of. Standard RMarkdown formatting rules work here. You can use ## to make a heading, which is generally how slide titles are made. You can make bullet points with -s, as demonstrated below Slides are separated with ---, so just add those characters any time you want a new one. Here’s an example:

## Reasons to use slidify

- Slides will work the same across all operating systems and on the web
- If your data changes, just rebuild the presentation and your done!
- Easy to include code snippets and their results
- You can do really cool interactive plots and things (that's a subject for another snippet, though)

--- .class #id 

## Pretty graph!

`` `{r}
library(ggplot2)
ggplot(data=Orange) + geom_line(aes(x=age, y=circumference, color=Tree))
`` `

---

## Look! Another slide

I can write whatever I want here.

And so on. Once you’ve made all of your slides, you can use the slidify command to make your presentation:

slidify("index.Rmd")

This will create an html document in your presentation’s directory. If you open it (in a web browser) you will see that you now have a webpage that acts as your presentation. You can use the arrow keys to go between slides.

0 Comments



Leave a Reply.

    Spatial Ecology @ MSU

    Click on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870)

    Category

    All
    Apply
    Biodiversity
    Cite R Package
    Clip Shapefile
    Data: Climate
    Data: Fire
    Data Manipulation
    Data: Spatial
    Data: Species
    Data: Vegetation
    Dates
    Debugging
    Distributions
    Gbif
    Glm
    Leaflet (R Package)
    Mapping
    Mapzen
    Plotting
    Polygon
    Projections
    Raster Stack
    Reclassify Raster
    R Markdown
    R Package: Dismo
    R Package: Ggplot2
    R Package: Maps
    R Package: Raster
    R Packages
    R Package: Tree
    R Package: Unmarked
    R Vignettes
    SDM: Bioclim
    SDM: Classification & Regression Trees
    SDM: Domain
    SDM: Gam
    SDM: Glm
    SDM: HSDM
    SDM: Maxent
    SDM: Random Forests
    Shapefile
    Spatial Clustering
    Tapply
    Text
    Time
    Variogram

    Archive

    October 2016
    September 2016
    December 2015
    November 2015
    October 2015
    September 2015

    RSS Feed

Powered by Create your own unique website with customizable templates.
  • Research & Training
  • R Code & Data
  • Other Resources