-
Notifications
You must be signed in to change notification settings - Fork 21
/
Intro.Rmd
38 lines (33 loc) · 1.28 KB
/
Intro.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
---
title: "Introduction to R and RStudio"
author: "Douglas Bates"
date: '2014-09-05'
output: ioslides_presentation
---
# Resources
## Web sites
- Materials for this course will be available at http://www.stat.wisc.edu/~st692/
- The materials are archived in the git repository https://github.com/dmbates/stat692/
- __RStudio__ can be downloaded from http://www.rstudio.com
- If you do not already have __R__ installed the __RStudio__ download site shows you where to download it
- Install __R__ first then install __RStudio__
- For later reference the [R Markdown Cheat Sheet](http://shiny.rstudio.com/articles/rm-cheatsheet.html) is helpful
- __CRAN__ (__C__omprehensive __R__ __A__rchive __N__etwork) packages can be accessed a tab in __RStudio__
## Simple use of R
- The basic R data structure is a _vector_. You can create vectors from sequences
```{r ss}
str(ss <- 1:10)
```
or using a repetitive sequence
```{r ones}
str(onetwo <- rep(c(0L,1L),5))
str(onestwos <- rep(c(0L,1L),c(5,5)))
```
## More constructors
- You can sample from various distributions
- The sampling functions have names that begin with the letter `r`
- Common distributions includes Normal (`norm`), Exponential (`exp`), Binomial (`binom`), Poisson (`pois`)
```{r rnorm}
str(nn <- rnorm(10))
str(nn12 <- rnorm(10,mean=1,sd=2))
```