Slide 1

Slide 1 text

Introduction to R/RStudio Patrick Kimes, PhD Postdoctoral Fellow Dana-Farber Cancer Institute Harvard TH Chan School of Public Health Top Ten Seminars October 1, 2019

Slide 2

Slide 2 text

October 1, 2019 October 22, 2019 November 12, 2019 December 10, 2019 January 21, 2020 February 11, 2020 March 17, 2020 April 14, 2020 May 19, 2020 June 16, 2020 Introduction to R and RStudio Data visualization with ggplot2 Data visualization principles and plots to avoid Design of Clinical Trials Basics Correlation: you are probably using it wrong How to detect and deal with batch effects Brief introduction to machine learning Culprits of the reproducibility crisis: multiple testing and p-hacking Experimental Design: How many size and should I pool? Detecting differentially expressed genes with RNA-seq top ten seminars in data science

Slide 3

Slide 3 text

R and RStudio?

Slide 4

Slide 4 text

R and RStudio? programming language R think Java, C, C++, Python, …

Slide 5

Slide 5 text

RStudio programming language R and RStudio? software to make data analysis with R easier

Slide 6

Slide 6 text

RStudio programming language R and RStudio? programming language R software to make data analysis with R easier

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

RStudio engine R dashboard

Slide 9

Slide 9 text

why R and RStudio?

Slide 10

Slide 10 text

what about SAS? why R and RStudio?

Slide 11

Slide 11 text

what about SAS? • R is free, open source • R is the home of new methods • R has a large, active community • R is highly interoperable, extensible why R and RStudio?

Slide 12

Slide 12 text

what about Python? why R and RStudio?

Slide 13

Slide 13 text

what about Python? • Good question! Up to you! • R is arguably easier to learn • R has more statistical tools • R makes exploration and visualization easier why R and RStudio?

Slide 14

Slide 14 text

why R and RStudio?

Slide 15

Slide 15 text

it gets you to the data fast! why R and RStudio?

Slide 16

Slide 16 text

it gets you to the data fast! and that’s fun! https://twitter.com/avogado6/status/1165595520967954432

Slide 17

Slide 17 text

who already has R / RStudio installed?

Slide 18

Slide 18 text

how to install R and RStudio

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

how to install R and RStudio 1. Search “R”, 
 Search “RStudio” 2. Install “R”, 
 Install “RStudio”

Slide 21

Slide 21 text

how to install R and RStudio 1. Search “R”, 
 Search “RStudio” 2. Install “R”, 
 Install “RStudio” maybe a few more steps so please do this later a much better guide: rafalab.github.io/dsbook/installing-r-rstudio

Slide 22

Slide 22 text

lucky us! we have a workaround! https://rstudio.cloud

Slide 23

Slide 23 text

lucky us! we have a workaround! https://rstudio.cloud do this

Slide 24

Slide 24 text

lucky us! we have a workaround! https://rstudio.cloud this too

Slide 25

Slide 25 text

lucky us! we have a workaround! https://rstudio.cloud select [from Git repo]

Slide 26

Slide 26 text

lucky us! we have a workaround! https://rstudio.cloud enter https://github.com/pkimes/dfci-introR

Slide 27

Slide 27 text

welcome to RStudio!

Slide 28

Slide 28 text

local RStudio select [New Project]

Slide 29

Slide 29 text

local RStudio select [Version Control]

Slide 30

Slide 30 text

local RStudio we’ll use [Git]

Slide 31

Slide 31 text

local RStudio enter https://github.com/pkimes/dfci-introR

Slide 32

Slide 32 text

we’re good to go!

Slide 33

Slide 33 text

you now have a project! what’s an RStudio project? basically a folder to organize an analysis • input data • R scripts • results/figures

Slide 34

Slide 34 text

coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding let’s give it a try!

Slide 35

Slide 35 text

arithmetic variables functions help installing packages loading packages for-loops what did we (hopefully) cover?

Slide 36

Slide 36 text

some pieces in the modern (R) data scientist’s toolbox

Slide 37

Slide 37 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 38

Slide 38 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 39

Slide 39 text

.R file

Slide 40

Slide 40 text

.R file .Rmd file

Slide 41

Slide 41 text

.R file .Rmd file formal header

Slide 42

Slide 42 text

.R file .Rmd file code “chunks”

Slide 43

Slide 43 text

.R file .Rmd file plain text (markdown)

Slide 44

Slide 44 text

.R file .Rmd file specified output format

Slide 45

Slide 45 text

.Rmd file

Slide 46

Slide 46 text

.Rmd file formatted text output! R code

Slide 47

Slide 47 text

rmarkdown documentation, communication myfile.Rmd markdown + R code chunks

Slide 48

Slide 48 text

rmarkdown documentation, communication myfile.Rmd markdown + R code chunks markdown myfile.md execute R code

Slide 49

Slide 49 text

rmarkdown documentation, communication myfile.Rmd markdown + R code chunks markdown myfile.md execute R code pandoc conversion

Slide 50

Slide 50 text

rmarkdown documentation, communication rmarkdown.rstudio.com

Slide 51

Slide 51 text

coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding coding let’s give it a try!

Slide 52

Slide 52 text

what did we (hopefully) cover? create a new Rmd file writing simple markdown creating code chunks executing code knitting documents

Slide 53

Slide 53 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 54

Slide 54 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 55

Slide 55 text

tidyverse data manipulation, visualization tidyverse.org

Slide 56

Slide 56 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 57

Slide 57 text

shiny web application framework shiny.rstudio.com

Slide 58

Slide 58 text

shiny web application framework shiny.rstudio.com/gallery/kmeans-example

Slide 59

Slide 59 text

some pieces in the modern (R) data scientist’s toolbox rmarkdown tidyverse shiny [bioconductor] documentation, communication data manipulation, visualization web application framework community of genomics packages

Slide 60

Slide 60 text

bioconductor community of genomics packages bioconductor.org

Slide 61

Slide 61 text

bioconductor community of genomics packages CRAN Bioconductor • genomic focus • software • annotations • data • package reviews • scope • consistency

Slide 62

Slide 62 text

awesome!

Slide 63

Slide 63 text

where do we go from here?

Slide 64

Slide 64 text

where do we go from here? wait, I’m lost

Slide 65

Slide 65 text

introduction to data science rafalab.github.io/dsbook

Slide 66

Slide 66 text

RStudio Cloud tutorials rstudio.cloud

Slide 67

Slide 67 text

r4ds.had.co.nz R for data science

Slide 68

Slide 68 text

learn the tidyverse tidyverse.org/learn

Slide 69

Slide 69 text

advanced R adv-r.hadley.nz

Slide 70

Slide 70 text

biomedical data science open online training rafalab.github.io/pages/harvardx

Slide 71

Slide 71 text

… and because it’s 2019, deep learning tensorflow.rstudio.com

Slide 72

Slide 72 text

questions? wait, I’m still lost