| Hosted by CoCalc | Download
---
title: Rmd Beamer Example author: John Doe date: July 9, 2018
---

Example of Beamer Slides from R Markdown

Outline

  • Instructions

  • An image

  • Two R code chunks

  • An equation typeset in LaTeX

  • References

How to Create Beamer Slides from an Rmd file

  • put title information in yaml prologue (optional)

  • open a .term file and run these commands

  • rendered view in Rmd editor may not look right - view the pdf file to see slides

$ R > library(rmarkdown) > render("filename.Rmd", beamer_presentation()) > quit() $ open filename.pdf

Image

NASA Exoplanet Exploration Program

LaTeX

Radius of planet: rp=rs×ΔBBr_p=r_s{\times}{\sqrt{\frac{{\Delta}B}{B}}}

Radius of planet's orbit: r=GMsP24π23r=\sqrt[3]{\frac{G{M_s}{P^2}}{4{{\pi}^2}}}

R Code Chunk 1

Get Data

qry <- paste0("table=exoplanets&select=", "pl_hostname,", "pl_letter,", "pl_discmethod,pl_publ_date") site <- paste0("http://exoplanetarchive.ipac.caltech.edu", "/cgi-bin/nstedAPI/nph-nstedAPI") url <- paste0(site, "?", qry) exo <- read.csv(url, stringsAsFactors=F) exo$pl_discmethod <- as.factor(exo$pl_discmethod) head(exo,3)

R Code Chunk 2

Yield for different methods of discovery. Use log scale on vertical axis

exot <- table(exo$pl_discmethod) exoto <- exot[order(exot,decreasing = T)] par(mar=c(12.5,3,3.5, 0.3), cex.main=1.5) barplot(exoto,las=2,col=rainbow(20), main="Exoplanets Discovered vs. Method", log="y", ylim=c(1,3000))

References

Beamer User Guide \newline http://tug.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf

R Markdown Presentations with Beamer \newline https://rmarkdown.rstudio.com/beamer_presentation_format.html

R function to create beamer slides \newline https://www.rdocumentation.org/packages/rmarkdown/versions/1.9/topics/beamer_presentation

NASA Exoplanet Exploration Program \newline https://exoplanets.nasa.gov/alien-worlds/exoplanet-travel-bureau/