forked from core-methods-in-edm/class-activity-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro-to-viz.Rmd
55 lines (40 loc) · 904 Bytes
/
intro-to-viz.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
---
title: "intro to viz"
author: "Charles Lang"
date: "October 3, 2016"
output: html_document
---
#Input
```{r}
D1 <- read.csv("School_Demographics_and_Accountability_Snapshot_2006-2012.csv", header = TRUE, sep = ",")
D2 <- subset(D1, schoolyear == 20112012)
```
#Histograms
```{r}
hist()
hist(D2$frl_percent, breaks = 100)
hist(D2$frl_percent, breaks = c(0,10,20,80,100))
hist(D2$frl_percent, breaks = 100, ylim = c(0,30))
```
#Plots
```{r}
plot(D2$ell_num, D2$ctt_num)
plot(D2$ell_num ~ D2$ctt_num)
#Barplot
x <- c(1,3,2,7,6,4,4)
y <- c(2,4,2,3,2,4,3)
table1 <- table(x,y)
barplot(table1)
#Lineplot
D3 <- aggregate(D1, by = list(D1$schoolyear), FUN = mean)
plot(D3$schoolyear, D3$total_enrollment, type = "l", lty = "dashed")
#Boxplot
D5 <- subset(D1, DBN == "31R075")
D5 <- droplevels(D5)
boxplot(D5$total_enrollment ~ D5$Name)
```
#Pairs
```{r}
D4 <- D2[,c(5,6, 21:24)]
pairs(D4)
```