The function aggregates continuous variables in large-scale assessments' data. The aggregation can be done by groups defined by the group.vars. Multiple grouping variables can be specified. All aggregations are done within each country separately.
Either data.file or data.object shall be provided as source of data. If both of them are provided, the function will stop with an error message.
The src.variables specifies the variables that shall be aggregated. Only continuous variables are accepted. PVs are not accepted.
The new.variables argument is optional and specifies the names of the new variables aggregated from the src.variables. The sequence of the new.variables names is the same as the src.variables. If the new.variables argument is omitted, the function will create the names automatically, appending AGGR at the end of the src.variables and store the aggregated variable data under these names. If provided, the number of new.variables must be the same as the number of src.variables.
The new.var.labels is optional. Regardless whether new.variables are provided, if new.var.labels are provided, they will be assigned to the new.variables generated from the aggregation. If neither new.variables not new.var.labels are provided, the function will automatically generate new.variables (see above) and copy the variable labels from src.variables to the newly generated variables, appending Aggregated at the beginning. The argument takes a vector with the same number of elements as the number of variable names in src.variables.
The aggr.fun specifies the function to be applied when performing the aggregation. The acceptable values are mean (default), median and mode. Using these methods, the aggregation will be performed by groups defined by the group.vars within each country.
If full path to .RData file is provided to out.file, the data.set will be written to that file. If no, the complemeted data will remain in the memory.