-
Notifications
You must be signed in to change notification settings - Fork 1
/
metainfo.R
59 lines (37 loc) · 1.46 KB
/
metainfo.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
### Tutorial from https://thomaselove.github.io/431notes-2017/dataviz.html
set.seed(431001)
library(dplyr)
library(ggplot2)
# use set.seed to ensure that we all get the same random sample
# of 1,000 NHANES subjects in our nh_data collection
metadatainfo <- sample_n(metadatainfo, size = 63) %>%
select(donor_ID, Age, Gender, Postmortem.time..hr., Ethnicity)
metadatainfo
ggplot(data = metadatainfo, aes(x = Age, y = Gender)) +
geom_point()
onhinfo <- metadatainfo %>%
filter(complete.cases(Age, Gender))
summary(onhinfo)
ggplot(data = onhinfo, aes(x = Age, y = Ethnicity, color = Gender)) +
geom_point() +
labs(title = "Ethnicity-Age Relationship in optic nerve samples",
y = "Ethnicity")
ggplot(data = onhinfo, aes(x = Age, y = Ethnicity, color = Gender)) +
geom_point() +
labs(title = "Ethnicity-Age Relationship in optic nerve samples",
y = "Ethnicity") +
facet_wrap(~ Gender)
ggplot(data = onhinfo, aes(x = Age, y = Ethnicity, color = Gender)) +
geom_point() +
geom_smooth(method = "loess") +
labs(title = "Ethnicity-Age Relationship in optic nerve samples",
y = "Ethnicity") +
theme_bw() +
facet_wrap(~ Gender)
ggplot(data = onhinfo, aes(x = Age)) +
geom_histogram()
ggplot(data = onhinfo, aes(x = Ethnicity, y = Gender, fill = Ethnicity)) +
geom_boxplot() +
labs(title = "metadata optic nerve",
x = "Ethnicity") +
guides(fill = FALSE)