-
Notifications
You must be signed in to change notification settings - Fork 3
/
scatterplots_race.R
63 lines (47 loc) · 2.82 KB
/
scatterplots_race.R
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
#Load Libraries
library(devtools)
library(easyGgplot2)
#Scatterplot Race vs Poverty - White
White <- ggplot(schooldata, aes(x=`% Poverty`, y=`% White`)) +
geom_point(shape=1) + ggtitle("Percent White") +
geom_smooth(method=lm, se=FALSE)
#Scatterplot Race vs Poverty - Hispanic
Hispanic <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Hispanic`)) +
geom_point(shape=1) + ggtitle("Percent Hispanic") +
geom_smooth(method=lm, se=FALSE)
#Scatterplot Race vs Poverty - Black
Black <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Black`)) +
geom_point(shape=1) + ggtitle("Percent Black") +
geom_smooth(method=lm, se=FALSE)
#Scatterplot Race vs Poverty - Asian
Asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Asian`)) +
geom_point(shape=1) + ggtitle("Percent Asian") +
geom_smooth(method=lm, se=FALSE)
ggplot2.multiplot(White, Hispanic, Black, Asian, cols = 2)
#Scatterplot Race vs poverty by Math mean scale score
math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Asian`, color = `Mean Scale Score Math`)) +
geom_point(shape=1) + ggtitle("Percent Asian") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
math_black <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Black`, color = `Mean Scale Score Math`)) +
geom_point(shape=1) + ggtitle("Percent Black") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
math_white <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% White`, color = `Mean Scale Score Math`)) +
geom_point(shape=1) + ggtitle("Percent White") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
math_hispanic <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Hispanic`, color = `Mean Scale Score Math`)) +
geom_point(shape=1) + ggtitle("Percent Hispanic") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
#Scatterplot Race vs poverty by Math mean scale score
eng_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Asian`, color = `Mean Scale Score English`)) +
geom_point(shape=1) + ggtitle("Percent Asian") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
eng_black <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Black`, color = `Mean Scale Score English`)) +
geom_point(shape=1) + ggtitle("Percent Black") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
eng_white <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% White`, color = `Mean Scale Score English`)) +
geom_point(shape=1) + ggtitle("Percent White") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
eng_hispanic <-math_asian <- ggplot(schooldata, aes(x=`% Poverty`, y=`% Hispanic`, color = `Mean Scale Score English`)) +
geom_point(shape=1) + ggtitle("Percent Hispanic") + ylim(0.0, 1.0) +
geom_smooth(method=lm, se=FALSE)
ggplot2.multiplot(math_asian, math_black, math_white, math_hispanic, eng_asian, eng_black, eng_white, eng_hispanic, col = 4)