My current dataset data.dfhas about 420 students who have completed 8 surveys under one of three instructors. escoreis my variable of interest.
'data.frame': 426 obs. of 10 variables:
$ ques01: int 1 1 1 1 1 1 0 0 0 1 ...
$ ques02: int 0 0 1 1 1 1 1 1 1 1 ...
$ ques03: int 0 0 1 1 0 0 1 1 0 1 ...
$ ques04: int 1 0 1 1 1 1 1 1 1 1 ...
$ ques05: int 0 0 0 0 1 0 0 0 0 0 ...
$ ques06: int 1 0 1 1 0 1 1 1 1 1 ...
$ ques07: int 0 0 1 1 0 1 1 0 0 1 ...
$ ques08: int 0 0 1 1 1 0 1 1 0 1 ...
$ inst : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
$ escore: int 3 1 5 5 3 3 4 4 2 5 ...
I am wondering how I can generate histograms escorethat are conditionally separated based on the value instfor this observation. In my head, the pseudo code might look like this:
par(mfrow=c(1,3))
hist(escore, data.df$inst = 1)
hist(escore, data.df$inst = 2)
hist(escore, data.df$inst = 3)
but of course this will not work: - (
Ideally, my histograms would look like this:
3 separate histograms of 140 observations, each of which is grouped according to their "inst" Value http://terpconnect.umd.edu/~briandk/escoreHistogramsbyInstructor-1.png
, , . "/" , , , , .
, , . , , , .
!