Make your account and install into RStudio
install.packages("devtools")
Start your first project
Quick note
*.Rproj in your .gitignore)readme.mdMore information: https://www.datacamp.com/community/tutorials/git-setup
Very simple guide on the workflow: http://rogerdudler.github.io/git-guide/
A more detailed guide: https://happygitwithr.com/rstudio-git-github.html
Use man git in Shell for help
git commit -m "Commit message"git push origin mastergit pull“R Markdown is a file format for making dynamic documents with R. An R Markdown document is written in markdown (an easy-to-write plain text format) and contains chunks of embedded R code, like the document below.” - https://rmarkdown.rstudio.com/articles_intro.html
Very simple. Next time you make a new file, make it a R Markdown file instead of a R script and save it as x.Rmd
Chunks
A mini-R-script in the middle of your text, headings, etc. in Markdown
E.g.:
library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.3.0
## ✔ tibble 2.1.1 ✔ dplyr 0.8.0.1
## ✔ tidyr 0.8.3 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ───────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
# Making a random dummy dataframe
x <- data.frame(replicate(5,sample(0:1,1000,rep=TRUE)))
# Print three rows of our dummy df
x[1:3,]
## X1 X2 X3 X4 X5
## 1 0 0 0 0 1
## 2 1 1 1 1 1
## 3 0 0 1 1 0
Chunk Options
You might not want to show your code, the warnings, and messages but show the output–Rmd let’s you control that.
E.g.: There’s a hidden chunk below but you’ll only see the table it outputs
| Cool table |
|---|
| X1 |
| 0 |
| 1 |
Global Options
You can also initialize a setup chunk with global chunk options like below.
# Random chunk options
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE, cache=TRUE, fig.pos = "H")
Here’s a cheat sheet: https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf
Cmd/Ctrl + Shift + K to knit to chosen formatThanks!