Util_nstud_wide {SchoolDataIT} | R Documentation |
Clean the raw dataframe of the number of students and arrange it in a wide format
Description
This function firstly cleans the output of the Get_nstud
function 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,
then it rearranges the data into a wide format, in such a way to represent the number of students, the number of classes and the average number of students by class at each school grade in a unique observation for each school.
Usage
Util_nstud_wide(
data = NULL,
missing_to_1 = FALSE,
nstud_imputation_thresh = 19,
UB_nstud_byclass = 99,
LB_nstud_byclass = 1,
verbose = TRUE,
autoAbort = FALSE,
...
)
Arguments
data |
Object of class |
missing_to_1 |
Logical. 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. The minimum threshold below which the number of classes is imputed to 1 if missing, if |
UB_nstud_byclass |
Numeric. The upper limit of the acceptable school-level average of the number of students by class. If a school has, on average, a higher number of students by class, the record is considered an outlier and filtered out. |
LB_nstud_byclass |
Numeric. The lower limit of the acceptable school-level average of the number of students by class. If a school has, on average, a smaller number of students by class, the record is considered an outlier and filtered out. |
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 |
Details
In the example, we compare the dataframe obtained with the default settings and the one imposed setting narrow inclusion criteria
Value
An object of class tbl_df
, tbl
and data.frame
Examples
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)