View source: R/Util_nstud_wide.R
Util_nstud_wide | R Documentation |
This function rearranges the output of the Get_nstud
function in such a way to represent the
counts of students and, if required, either the number of students by class and number of classes, or
the counts of students per school timetable (running time) in a unique observation per school.
If the focus is on class size, this function firstly cleans the data from the outliers in terms of
average number of students by class at the school level and imputates the number of classes to 1 when missing.
Util_nstud_wide(
data = NULL,
missing_to_1 = FALSE,
nstud_imputation_thresh = 19,
UB_nstud_byclass = 99,
LB_nstud_byclass = 1,
filter_by_grade = FALSE,
UB_nstud_byclass_grade = NULL,
LB_nstud_byclass_grade = NULL,
verbose = TRUE,
autoAbort = FALSE,
...
)
data |
Object of class |
missing_to_1 |
Logical. If focus is on class size, whether the number of classes should be imputed to 1 when it is missing and the number of students is below a threshold (argument |
nstud_imputation_thresh |
Numeric. If focus is on class size, the minimum threshold below which the number of classes is imputed to 1 if missing, if |
UB_nstud_byclass |
Numeric. Either a unique value for all school orders, or a vector of three order-specific values in the order: primary, middle, high.
If focus is on class size, the upper limit of the acceptable school-level (if |
LB_nstud_byclass |
Numeric. Either a unique value for all school orders, or a vector of three order-specific values in the order: primary, middle, wide.
If focus is on class size, the lower limit of the acceptable school-level (if |
filter_by_grade |
Logical. If focus is on class size, whether to remove all school grades with average class size outside of the acceptance boundaries. |
UB_nstud_byclass_grade |
Numeric. IF |
LB_nstud_byclass_grade |
Numeric. IF |
verbose |
Logical. If |
autoAbort |
Logical. In case any data must be retrieved, whether to automatically abort the operation and return NULL in case of missing internet connection or server response errors. |
... |
Arguments to |
In the example, we compare the dataframe obtained with the default settings and the one imposed setting narrow inclusion criteria
An object of class tbl_df
, tbl
and data.frame
nstud.default <- Util_nstud_wide(example_input_nstud23)
nstud.narrow <- Util_nstud_wide(example_input_nstud23,
UB_nstud_byclass = 35, LB_nstud_byclass = 5 )
nrow(nstud.default)
nrow(nstud.narrow)
nstud.default
summary(nstud.default)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.