-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wille_Nakpil_Final_Project.R
77 lines (53 loc) · 2.13 KB
/
Wille_Nakpil_Final_Project.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
##############################################################################
## IMT 572 Final Project, Data Analysis & Visualization
## Author: "Willie Nakpil & Taylor Polson"
## Description: Here is the code we used for out Final Project
## Analyzing Males in the Workforce from 1980-1987
##############################################################################
#install.packages("data.table")
#install.packages("plm")
#install.packages("ggplot2")
library(plm)
library(data.table)
library(ggplot2)
data(Males)
Males <- data.table(Males)
head(Males)
summary(Males)
?Males
?hist
hist(Males)
#Plot 1 How school impacts wages faceted by ethnicity
ggplot(Males, aes(x=school, y=wage))+
geom_jitter(aes(color=occupation))+
facet_grid(ethn~.)+
labs(title="Total Males Years of school vs. wage, faceted by ethnicity",
x="Years of School",
y="Hourly Wage")
###Plot 2 Sales Workers Only, facet by married
Sales_Men <- Males[occupation=="Sales_Workers",]
ggplot(Sales_Men, aes(x=school, y=wage))+
geom_jitter(aes(color=occupation, shape=ethn),size=2)+
facet_grid(married~.)+
labs(title="Sales Workers Years of school vs. wage, faceted by marital status",
x="Years of School",
y="Hourly Wage")
summary(Sales_Men)
###Plot 3 White Collar Workers Only, facet by married
White_Collar_Men <- Males[occupation=="Professional, Technical_and_kindred",]
ggplot(White_Collar_Men, aes(x=school, y=wage))+
geom_jitter(aes(color=occupation, shape=ethn),size=2)+
facet_grid(married~.)+
labs(title="Professional & Technical Workers Years of school vs. wage, faceted by marital status",
x="Years of School",
y="Hourly Wage")
summary(White_Collar_Men)
###Plot 4 Service Workers Only faceted by marital status."
Service_Men <- Males[occupation=="Service_Workers",]
ggplot(Service_Men, aes(x=school, y=wage))+
geom_jitter(aes(color=occupation, shape=ethn),size=2)+
facet_grid(married~.)+
labs(title="Service Workers Years of school vs. wage, faceted by marital status",
x="Years of School",
y="Hourly Wage")
summary(Service_Men)