haircut

references:
- ISI, exploration 6.1b, p.330

library(tidyverse)

data

patient

df.patient <- read.csv("patient.csv")
df.patient$patient <- factor(df.patient$patient, levels = df.patient$patient)
str(df.patient)
## 'data.frame':    12 obs. of  2 variables:
##  $ patient: Factor w/ 12 levels "<3","3","4","5",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ count  : int  6 4 4 3 3 2 6 5 4 7 ...

pamphlet

df.pamphlet <- read.csv("pamphlet.csv")
df.pamphlet$pamphlet <- factor(df.pamphlet$pamphlet, levels = df.pamphlet$pamphlet)
str(df.pamphlet)
## 'data.frame':    11 obs. of  2 variables:
##  $ pamphlet: Factor w/ 11 levels "6","7","8","9",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ count   : int  3 3 8 4 1 1 4 2 1 2 ...

medians

(n.patient <- sum(df.patient$count))
## [1] 63
median.patient <-  9       # score of patient in position (63 + 1) / 2 = 32
(n.pamphlet <- sum(df.pamphlet$count))
## [1] 30
median.pamphlet <-  9       # average of scores in positions 15 and 16

barplots

ggplot(df.patient, aes(x = patient, y = count, fill = patient)) +
  geom_bar(stat = "identity") +
  labs(title = "Patient")