A case study

## 
## 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':    2571 obs. of  6 variables:
##  $ ID  : int  1015 1052 1062 1092 1130 1018 1029 1030 1588 1154 ...
##  $ Name: chr  "Hora Hora School" "Morningside School" "Onerahi School" "Raurimu Avenue School" ...
##  $ City: Factor w/ 541 levels "Ahaura","Ahipara",..: 533 533 533 533 533 533 533 533 533 533 ...
##  $ Auth: Factor w/ 4 levels "Other","Private",..: 3 3 3 3 3 3 3 3 4 3 ...
##  $ Dec : int  2 3 4 2 4 8 5 5 6 1 ...
##  $ Roll: int  318 200 455 86 577 329 637 395 438 201 ...
## [1] 2571    6

Binning

##     ID                  Name      City  Auth Dec Roll
## 1 1015      Hora Hora School Whangarei State   2  318
## 2 1052    Morningside School Whangarei State   3  200
## 3 1062        Onerahi School Whangarei State   4  455
## 4 1092 Raurimu Avenue School Whangarei State   2   86
## 5 1130      Whangarei School Whangarei State   4  577
## 6 1018       Hurupaki School Whangarei State   8  329
## 
##  Small Mediam  Large 
##   2555     15      1
##  Small Mediam  Large 
##   2555     15      1

Sorting

##       ID                  Name         City  Auth Dec Roll   Size RollOrd
## 1726 498 Correspondence School   Wellington State  NA 5546  Large     753
## 301   28     Rangitoto College     Auckland State  10 3022 Mediam     353
## 376   78      Avondale College     Auckland State   4 2613 Mediam     712
## 2307 319  Burnside High School Christchurch State   8 2588 Mediam     709
## 615   41      Macleans College     Auckland State  10 2476 Mediam    1915
## 199   43    Massey High School     Auckland State   5 2452 Mediam    1683
##        ID                    Name                  City    Auth Dec Roll  Size
## 2401 1641  Amana Christian School               Dunedin Private   9    7 Small
## 1590 2461       Tangimoana School              Manawatu   State   4    6 Small
## 1996 3598         Woodbank School              Kaikoura   State   4    6 Small
## 2112 3386     Jacobs River School          Jacobs River   State   5    6 Small
## 1514 2407     Ngamatapouri School Sth Taranaki District   State   9    5 Small
## 1575 2420 Papanui Junction School               Taihape   State   5    5 Small
##      RollOrd
## 2401    2562
## 1590     266
## 1996    2478
## 2112    1501
## 1514    2377
## 1575    1542
##        ID                      Name      City  Auth Dec Roll  Size RollOrd
## 2548  401           Menzies College   Wyndham State   4  356 Small     859
## 2549 4054            Wyndham School   Wyndham State   5   94 Small    1163
## 1611 2742          Woodville School Woodville State   3  147 Small     726
## 1630 2640           Papatawa School Woodville State   7   27 Small    2273
## 2041 3600            Woodend School   Woodend State   9  375 Small    1401
## 1601  399 Central Southland College    Winton State   7  549 Small     450
##        ID                         Name    City  Auth Dec Roll  Size RollOrd
## 2169 3273                Albury School  Albury State   8   30 Small    1010
## 2018  350           Akaroa Area School  Akaroa State   8  125 Small    1051
## 2023 3332           Duvauchelle School  Akaroa State   9   41 Small     749
## 335  1200                Ahuroa School  Ahuroa State   7   22 Small     193
## 99   1000               Ahipara School Ahipara State   3  241 Small    1963
## 2117 2105 Awahono School - Grey Valley  Ahaura State   4  119 Small     364

Counting

## 
##            Other          Private            State State Integrated 
##                1               99             2144              327
##            Other          Private            State State Integrated 
##                1               99             2144              327
## 
##            Other          Private            State State Integrated 
##                1               99             2144              327
## [1] "table"
##       ID            Name         City  Auth Dec Roll  Size RollOrd
## 2315 518 Kingslea School Christchurch Other   1   51 Small    1579
##                   Dec
## Auth                 1   2   3   4   5   6   7   8   9  10
##   Other              1   0   0   0   0   0   0   0   0   0
##   Private            0   0   2   6   2   2   6  11  12  38
##   State            259 230 208 219 214 215 188 200 205 205
##   State Integrated  12  22  35  28  38  34  45  45  37  31

Aggregating

## [1] 295.4737
## [1] 308.798
##            Group.1     Roll
## 1            Other  51.0000
## 2          Private 308.7980
## 3            State 300.6301
## 4 State Integrated 258.3792
##            Other          Private            State State Integrated 
##          51.0000         308.7980         300.6301         258.3792
## [1] FALSE FALSE FALSE FALSE FALSE  TRUE
##            Group.1 Group.2     Roll
## 1            Other   FALSE  51.0000
## 2          Private   FALSE 151.4000
## 3            State   FALSE 261.7487
## 4 State Integrated   FALSE 183.2370
## 5          Private    TRUE 402.5362
## 6            State    TRUE 338.8243
## 7 State Integrated    TRUE 311.2135
## # A tibble: 7 x 3
## # Groups:   Auth [4]
##   Auth             Rich   Roll
##   <fct>            <lgl> <dbl>
## 1 Other            FALSE   51 
## 2 Private          FALSE  151.
## 3 Private          TRUE   403.
## 4 State            FALSE  262.
## 5 State            TRUE   339.
## 6 State Integrated FALSE  183.
## 7 State Integrated TRUE   311.
## : Other
## [1] 51 51
## ------------------------------------------------------------ 
## : Private
## [1]    7 1663
## ------------------------------------------------------------ 
## : State
## [1]    5 5546
## ------------------------------------------------------------ 
## : State Integrated
## [1]   18 1475
## $Other
## [1] 51 51
## 
## $Private
## [1]    7 1663
## 
## $State
## [1]    5 5546
## 
## $`State Integrated`
## [1]   18 1475