Load the data.

knitr::opts_chunk$set(echo = TRUE)
library(data.table)
cf <- fread('individual_cf.csv')
#ce2 <- fread('ce2_dataset.csv')
#ind_ce2 <- fread('individual_ce2.csv')

for (j in paste0('cf',seq(1,24))){
  print(knitr::kable(table(cf[[j]]),col.names = c(j, 'n')))
}

Code two-or-more ‘some’ difficulty measure of functional difficulty

qs <- paste0('cf',c(3,6,12,14,15,16,17,18,19,20,21,23,24))
cf$functionaldifficulty2 <- apply(cf[,..qs], 1, function(X) ifelse(sum(X==2)>=2,1,0))
knitr::kable(t(format(table(cf$functionaldifficulty2), 
             big.mark = ',')), 
             col.names = c('No difficulty','Two-or-more some diff.'))
No difficulty Two-or-more some diff.
39,426 2,058

Plot of the number reporting different amounts of some or a lot of difficulty

Some difficulty

x <- table(apply(cf[,..qs], 1, function(X) sum(X==2)))
barplot(x[2:length(x)], border = F)

A lot of difficulty

x <- table(apply(cf[,..qs], 1, function(X) sum(X==3)))
barplot(x[2:length(x)], border = F)

Plot the responses to the questions

Percentages

cols <- c('seeing', 'hearing', 'walking', 'selfcare', 'communication','learning','remembering',
  'concentrating', 'acceptingchange', 'behaviour', 'makingfriends', 'anxiety', 
  'depression', 'functionaldifficulty'
  )
p <- as.matrix(cf[,lapply(.SD, function(X) mean(X, na.rm = T)),.SDcols=cols])

text(cex=1, x=barplot(p, xaxt="n", yaxt="n",ylim=c(0,.06), col='gray80')-.2, y=p+0.001, 
     colnames(p), xpd=TRUE, srt=90, pos=4)
axis(2, at=pretty(p), lab=paste0(pretty(p) * 100,'%'), las=TRUE)

Number of children

p <- as.matrix(cf[,lapply(.SD, function(X) sum(X, na.rm = T)),.SDcols=cols])

text(cex=1, x=barplot(p, xaxt="n", yaxt="n",ylim=c(0,1500), col='gray80')-.2, y=p+0.001, 
     colnames(p), xpd=TRUE, srt=90, pos=4)
axis(2, at=pretty(p), lab=pretty(p), las=TRUE)