A case study - II

## [1] 88  4
## 'data.frame':    88 obs. of  4 variables:
##  $ Name  : chr  "Al-Madinah School" "Alfriston College" "Ambury Park Centre for Riding Therapy" "Aorere College" ...
##  $ Level1: num  61.5 53.9 33.3 39.5 71.2 22.1 50.8 57.3 89.3 59.8 ...
##  $ Level2: num  75 44.1 20 50.2 78.9 30.8 34.8 49.8 89.7 65.7 ...
##  $ Level3: num  0 0 0 30.6 55.5 26.3 48.9 44.6 88.6 50.4 ...
##                                    Name Level1 Level2 Level3
## 1                     Al-Madinah School   61.5   75.0    0.0
## 2                     Alfriston College   53.9   44.1    0.0
## 3 Ambury Park Centre for Riding Therapy   33.3   20.0    0.0
## 4                        Aorere College   39.5   50.2   30.6
## 5        Auckland Girls' Grammar School   71.2   78.9   55.5
## 6                      Auckland Grammar   22.1   30.8   26.3
##   values  level                                  name
## 1   61.5 Level1                     Al-Madinah School
## 2   53.9 Level1                     Alfriston College
## 3   33.3 Level1 Ambury Park Centre for Riding Therapy
## 4   39.5 Level1                        Aorere College
## 5   71.2 Level1        Auckland Girls' Grammar School
## 6   22.1 Level1                      Auckland Grammar
##   Level1   Level2   Level3 
## 62.26705 61.06818 47.97614
##   Level1   Level2   Level3 
## 62.26705 61.06818 47.97614
## $Level1
## [1] 62.26705
## 
## $Level2
## [1] 61.06818
## 
## $Level3
## [1] 47.97614
##    level   values
## 1 Level1 62.26705
## 2 Level2 61.06818
## 3 Level3 47.97614

Simplify the list apply

##   Level1   Level2   Level3 
## 62.26705 61.06818 47.97614
##      Level1 Level2 Level3
## [1,]    2.8    0.0    0.0
## [2,]   97.4   95.7   95.7
##      Level1 Level2 Level3
## [1,]    2.8    0.0    0.0
## [2,]   97.4   95.7   95.7
## $Level1
## [1]  2.8 97.4
## 
## $Level2
## [1]  0.0 95.7
## 
## $Level3
## [1]  0.0 95.7
##    level values.1 values.2
## 1 Level1      2.8     97.4
## 2 Level2      0.0     95.7
## 3 Level3      0.0     95.7
##      Level1 Level2 Level3
## [1,]    2.8    0.0    0.0
## [2,]   97.4   95.7   95.7

Splitting

## List of 4
##  $ Other           : int 51
##  $ Private         : int [1:99] 255 39 154 73 83 25 95 85 94 729 ...
##  $ State           : int [1:2144] 318 200 455 86 577 329 637 395 201 267 ...
##  $ State Integrated: int [1:327] 438 26 191 560 151 114 126 171 211 57 ...
## [1] "list"
## $Other
## [1] 51
## 
## $Private
## [1] 308.798
## 
## $State
## [1] 300.6301
## 
## $`State Integrated`
## [1] 258.3792
##            Other          Private            State State Integrated 
##          51.0000         308.7980         300.6301         258.3792
## $Other
## [1] 51
## 
## $Private
## [1] 308.798
## 
## $State
## [1] 300.6301
## 
## $`State Integrated`
## [1] 258.3792
##            Other          Private            State State Integrated 
##          51.0000         308.7980         300.6301         258.3792
##               Auth     Roll
## 1            Other  51.0000
## 2          Private 308.7980
## 3            State 300.6301
## 4 State Integrated 258.3792
## 
## 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
## # A tibble: 4 x 2
##   Auth              Roll
##   <fct>            <dbl>
## 1 Other              51 
## 2 Private           309.
## 3 State             301.
## 4 State Integrated  258.