-
Notifications
You must be signed in to change notification settings - Fork 1
/
Untitled.R
67 lines (55 loc) · 3.91 KB
/
Untitled.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
install.packages("tidyverse")
install.packages("ggplot2")
library(ggplot2)
setwd("/Users/christinesfkao/R-University-Assistant-Investigation/student-workers/")
data = read.csv("data.csv")
ggplot(data, aes(x = data$totalrev, fill = data$grad))
#totalrev
hist(data$totalrev[data$grad == FALSE], col = rgb(1, 0, 0, 0.5), xlim = c(0, 50000), ylim = c(0, 120),
main = "Histogram of Total Revenue", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalrev[data$grad == TRUE], col = rgb(0, 0, 1, 0.5), breaks = 20, add = TRUE)
hist(data$totalrev[data$school == "public"], col = rgb(0, 0, 1, 0.5), xlim = c(0, 50000), ylim = c(0, 120),
main = "Histogram of Total Revenue", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalrev[data$school == "private"], col = rgb(0, 1, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalrev[data$region == "north"], col = rgb(0.7, 0, 0, 0.5), xlim = c(0, 50000), ylim = c(0, 120),
main = "Histogram of Total Revenue", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalrev[data$region == "south"], col = rgb(0, 0.7, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalrev[data$region == "central"], col = rgb(0, 0, 1, 0.5), breaks = 20, add = TRUE)
hist(data$totalrev[data$region == "others"], col = rgb(1, 0, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalrev[data$region == "east"], col = rgb(0, 0, 0.7, 0.5), add = TRUE)
#totalexp
hist(data$totalexp[data$grad == FALSE], col = rgb(1, 0, 0, 0.5), xlim = c(0, 100000), ylim = c(0, 250),
main = "Histogram of Total Expenses", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalexp[data$grad == TRUE], col = rgb(0, 0, 1, 0.5), breaks = 20, add = TRUE)
hist(data$totalexp[data$school == "public"], col = rgb(0, 0, 1, 0.5), xlim = c(0, 100000), ylim = c(0, 250),
main = "Histogram of Total Expenses", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalexp[data$school == "private"], col = rgb(0, 1, 0, 0.5), add = TRUE)
hist(data$totalexp[data$region == "north"], col = rgb(0.7, 0, 0, 0.5), xlim = c(0, 100000), ylim = c(0, 250),
main = "Histogram of Total Expenses", xlab = "NTD $", ylab = "Persons", breaks = 20)
hist(data$totalexp[data$region == "south"], col = rgb(0, 0.7, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalexp[data$region == "central"], col = rgb(0, 0, 1, 0.5), add = TRUE)
hist(data$totalexp[data$region == "others"], col = rgb(1, 0, 0, 0.5), add = TRUE)
hist(data$totalexp[data$region == "east"], col = rgb(0, 0, 0.7, 0.5), add = TRUE)
#totalwhr
hist(data$totalwhr[data$grad == FALSE], col = rgb(1, 0, 0, 0.5), xlim = c(0, 250), ylim = c(0, 100),
main = "Histogram of Total Working Hours", xlab = "Hours per month", ylab = "Persons", breaks = 20)
hist(data$totalwhr[data$grad == TRUE], col = rgb(0, 0, 1, 0.5), breaks = 20, add = TRUE)
hist(data$totalwhr[data$school == "藍色是功力難度、public"], col = rgb(0, 0, 1, 0.5), xlim = c(0, 250), ylim = c(0, 100),
main = "Histogram of Total Working Hours", xlab = "Hours per month", ylab = "Persons", breaks = 20)
hist(data$totalwhr[data$school == "private"], col = rgb(0, 1, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalwhr[data$region == "north"], col = rgb(0.7, 0, 0, 0.5), xlim = c(0, 250), ylim = c(0, 100),
main = "Histogram of Total Working Hours", xlab = "Hours per month", ylab = "Persons", breaks = 20)
hist(data$totalwhr[data$region == "south"], col = rgb(0, 0.7, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalwhr[data$region == "central"], col = rgb(0, 0, 1, 0.5), breaks = 20, add = TRUE)
hist(data$totalwhr[data$region == "others"], col = rgb(1, 0, 0, 0.5), breaks = 20, add = TRUE)
hist(data$totalwhr[data$region == "east"], col = rgb(0, 0, 0.7, 0.5), add = TRUE)
紅色
+
geom_histogram(breaks=seq(20, 50, by = 2),
col="red",
fill="green",
alpha = .2) +
labs(title="Histogram for Total Revenue") +
labs(x="NTD $", y="Count") +
xlim(c(0,50000)) +
ylim(c(0,120))