Histogram of IQ for each of 5 Classes with over 30 Pupil
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## 'data.frame': 2287 obs. of 6 variables:
## $ lang : int 46 45 33 46 20 30 30 57 36 36 ...
## $ IQ : num 15 14.5 9.5 11 8 9.5 9.5 13 9.5 11 ...
## $ class: Factor w/ 133 levels "180","280","1082",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ GS : int 29 29 29 29 29 29 29 29 29 29 ...
## $ SES : int 23 10 15 23 10 10 23 10 13 15 ...
## $ COMB : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
| 46 |
15.0 |
180 |
29 |
23 |
0 |
| 45 |
14.5 |
180 |
29 |
10 |
0 |
| 33 |
9.5 |
180 |
29 |
15 |
0 |
| 46 |
11.0 |
180 |
29 |
23 |
0 |
| 20 |
8.0 |
180 |
29 |
10 |
0 |
| 30 |
9.5 |
180 |
29 |
10 |
0 |
dta <- as_tibble(dta)
dta1 <- dta %>% group_by(class) %>% summarize(total=n()) %>%
filter(total >30)
dta2 <- dta[dta$class %in% dta1$class, ]
dta2$class <- dta2$class %>% as.character()
dta2 <-split(dta2,dta2$class)
plot.new()
par(mfrow=c(2, 3), mar=c(2, 2, 2, 1))
lapply(dta2, function(x) {hist(x$IQ,main = "histogram of IQ",
axes = F,
breaks = seq(6, 18, by =
2))
axis(1,
at = seq(6, 18, 2))
legend("topright",
paste("class",
x$class[1],
sep = ": "),
bty="n")})
## $`15580`
## $`15580`$rect
## $`15580`$rect$w
## [1] 5.787328
##
## $`15580`$rect$h
## [1] 2.024178
##
## $`15580`$rect$left
## [1] 12.69267
##
## $`15580`$rect$top
## [1] 14.56
##
##
## $`15580`$text
## $`15580`$text$x
## [1] 14.01721
##
## $`15580`$text$y
## [1] 13.54791
##
##
##
## $`15980`
## $`15980`$rect
## $`15980`$rect$w
## [1] 5.787328
##
## $`15980`$rect$h
## [1] 2.024178
##
## $`15980`$rect$left
## [1] 12.69267
##
## $`15980`$rect$top
## [1] 14.56
##
##
## $`15980`$text
## $`15980`$text$x
## [1] 14.01721
##
## $`15980`$text$y
## [1] 13.54791
##
##
##
## $`16180`
## $`16180`$rect
## $`16180`$rect$w
## [1] 5.787328
##
## $`16180`$rect$h
## [1] 2.168763
##
## $`16180`$rect$left
## [1] 12.69267
##
## $`16180`$rect$top
## [1] 15.6
##
##
## $`16180`$text
## $`16180`$text$x
## [1] 14.01721
##
## $`16180`$text$y
## [1] 14.51562
##
##
##
## $`18380`
## $`18380`$rect
## $`18380`$rect$w
## [1] 5.787328
##
## $`18380`$rect$h
## [1] 2.891684
##
## $`18380`$rect$left
## [1] 12.69267
##
## $`18380`$rect$top
## [1] 20.8
##
##
## $`18380`$text
## $`18380`$text$x
## [1] 14.01721
##
## $`18380`$text$y
## [1] 19.35416
##
##
##
## $`5480`
## $`5480`$rect
## $`5480`$rect$w
## [1] 5.378079
##
## $`5480`$rect$h
## [1] 1.879594
##
## $`5480`$rect$left
## [1] 13.10192
##
## $`5480`$rect$top
## [1] 13.52
##
##
## $`5480`$text
## $`5480`$text$x
## [1] 14.42646
##
## $`5480`$text$y
## [1] 12.5802
