-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFriendlyIntro.Rmd
133 lines (110 loc) · 3.4 KB
/
FriendlyIntro.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
output:
slidy_presentation: default
ioslides_presentation: default
pdf_document: default
html_document: default
---
---
title: "A Friendly Intro to R - BioData Club"
author: "Danielle Robinson & Lilly Winfree"
date: "May 26 2017"
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Before we begin
- Download R - this is the binary containing R language stuff - it comes with a basic interface, but we won't use it. You need to download this first so your computer will know what to do with R Studio.
+ https://cran.rstudio.com/
- Download R Studio - this is an interface that makes it easy to work with R.
+ https://www.rstudio.com/products/rstudio/download3/
- Go to our Github page:
+ https://github.com/BioData-Club/Friendly-Intro-to-R
```{r fig.width=5, fig.height=3,echo=FALSE}
library(png)
library(grid)
img <- readPNG("~/Friendly-Intro-to-R/Github.png")
grid.raster(img)
```
- Click on "Clone or Download"
- Click on "Download Zip"
## Why should you use R??
- Free!
+ unlike Prism, excel
- Open Source
+ Tons of support, packages, tools
+ Don't trap your file in proprietary format!
- Great for stats
+ Defaults not hidden, question assumptions
## Basics (1)
- use # to comment
- "**<-**" assigns values to a variable
```{r}
x<-1
x
```
- = assigns a value ( x = 5)
- == assigns equality (a == b)
- functions ()
```{r}
print(x)
```
## Basics (2)
- help() and ?
- in R console, use up arrow to re-type what you just wrote
- variable names can't start with a number
+ eg Data1 not 1Data
- throwing errors is normal! You will create errors _a lot_
- when you need to install package:
+ install.packages("png")
### R is _stupid_ and only knows what _you_ input
##This is what R Studio looks like:
```{r fig.width=8, fig.height=5,echo=FALSE}
library(png)
library(grid)
img <- readPNG("~/Friendly-Intro-to-R/rstudio.png")
grid.raster(img)
```
## Resources
- CRAN: https://cran.r-project.org
- http://stackoverflow.com - like google for coding questions
- R Markdown cheat sheets (rmarkdown.rstudio.com)
- Ted Laderas' R bootcamp: https://github.com/laderast/r-bootcamp
- Mozilla study groups: https://github.com/mozillascience/studyGroupLessons/issues
- R Open Sci (https://ropensci.org)
- R meetup groups (https://www.meetup.com/portland-r-user-group/)
- cookbook-r.com
- tidyverse
- Hadley Wickham (https://en.wikipedia.org/wiki/Hadley_Wickham)
- additional plotting abilities with ggplot package (we're not going into this)
## Fun Events: cascadiarconf.com
```{r fig.width=8, fig.height=5,echo=FALSE}
library(png)
library(grid)
img1 <- readPNG("~/Friendly-Intro-to-R/RConf.png")
grid.raster(img1)
```
## Fun Events: Science Hack Day PDX!
- http://portland.sciencehackday.org/
- Join us on Slack! pdxscience.slack.com
```{r fig.width=8, fig.height=5,echo=FALSE}
library(png)
library(grid)
img1 <- readPNG("~/Friendly-Intro-to-R/SHD_2017.png")
grid.raster(img1)
```
## Fun Events: BioData Club
- https://biodata-club.github.io/
```{r fig.width=8, fig.height=5,echo=FALSE}
img2 <- readPNG("~/Friendly-Intro-to-R/Hex-BDP.png")
grid.raster(img2)
```
- Join us on Slack! biodata-club.slack.com
## Let's go!
From the Github downloaded files, open:
- "example_lengths_for_R.csv"
- "BasicStatsCode.pdf"
We'll start with "BasicStatsCode.pdf"
###_PLEASE ASK US IF YOU ARE CONFUSED! :-)_
Use your **yellow** sticky note for "confused" and **green** for "ok"