rmarkdown

Getting started with rmarkdown

Remarks#

This section provides an overview of what rmarkdown is, and why a developer might want to use it.

It should also mention any large subjects within rmarkdown, and link out to the related topics. Since the Documentation for rmarkdown is new, you may need to create initial versions of those related topics.

Installation or Setup

Detailed instructions on getting rmarkdown set up or installed.

Hello World!

---
title: "Hello World!"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)

# Running the setup first allows you to set the options for how each chunk of R code
# will be handled, and the options are in fact part of the first chunk.
# In this example, I've set the echo = FALSE so the R code isn't displayed to the user

#Note that if you want to load any other dependencies, you can load them here:
library(ggplot2)

# Always end the chunk before moving on to the regular markdown content using:

```

# Getting Started with RMarkdown

The heading is denoted with the hashtag (#) and a space. Review the pandoc markdown 
to see what's available knowing you can always write customized 
HTML or LaTeX as needed.

```{r intro, echo=TRUE}
# for this chunk, I turned the echo = TRUE so you can see the R output.
# each chunk should have different names so you can easily debug your code

```

# Graphs with RMarkdown

```{r graphs}
data <- cars
ggplot(data, aes(x = speed, y = dist)) +
  geom_point()
```

# Tables with RMarkdown

## Using R Output

```{r tables, echo =FALSE}
# table with just R output
head(cars, n=10)
```

## Tables with RMarkdown

## Using grid.draw

```{r tables_grid}
# table with grid/gridExtra packages
library(grid)
library(gridExtra)
x <- tableGrob(head(cars, n=10))
grid.draw(x)

```

# You got this!

Now try changing the output in the header/YAML from html_document to ioslides_presentation and see how things change!

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow