-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprac9.R
32 lines (24 loc) · 857 Bytes
/
prac9.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
library(tidyverse)
library(dslabs)
data("heights")
h <- heights %>%
filter(sex=='Male') %>%
ggplot(aes(x=height))
h <- h + geom_density(fill='blue')
h <- h + geom_histogram(binwidth = 1,fill='blue',col='black') +
xlab('Male heights in inches') +
ggtitle('Histogram')
params <- heights %>%
filter(sex == 'Male') %>%
summarize(mean = mean(height),sd = sd(height))
# h <- heights %>%
# filter(sex=='Male') %>%
# ggplot(aes(sample=scale(height)))
# h <- h + geom_qq() + #use dparams = paramas if data
# geom_abline() #not scaled
h1 <- h + geom_histogram(binwidth = 1,fill='blue',col='black')
h2 <- h + geom_histogram(binwidth = 2,fill='blue',col='black')
h3 <- h + geom_histogram(binwidth = 3,fill='blue',col='black')
library(gridExtra)
grid.arrange(h1,h2,h3,ncol=3)
print(h)