prepareSGP {SGP} | R Documentation |
Prepare data for SGP analyses
Description
Utility function/exemplar used to embed supplied long data into a list object as a keyed data.table. NOTE: This function also serves the purposes of running many checks on the SGP object you
construct to make sure it is up to date and in the best shape possible. If you have an older object that you wish to make sure is up to date with the latest version of the SGP package, running
prepareSGP
on an object is never bad thing to do. See examples for more information.
Usage
prepareSGP(data,
data_supplementary=NULL,
state=NULL,
var.names=NULL,
create.additional.variables=TRUE,
fix.duplicates=NULL)
Arguments
data |
A panel data set in long form or an object of class SGP. See embedded |
data_supplementary |
Supplementary data (e.g., student teacher lookup tables) to be embedded in SGP object in slot @Data_Supplementary. Data must be embedded in a list. Default is no data supplied. |
state |
A two letter acronym indicating the state associated with the data. If not supplied, the function will try to infer what the state is from the data object name supplied. |
var.names |
A list or a data.frame that includes all required columns that do not match the SGP conventions, as well as all secondary columns needed for summarizing and reporting. |
create.additional.variables |
Boolean argument indicating whether prepareSGP should create additional variables often used in analyses. For example, the function can create a variable
|
fix.duplicates |
Argument to control how |
Value
Function returns an object of class SGP
. The long data is
in the data
slot.
Author(s)
Adam Van Iwaarden avaniwaarden@nciea.org, Damian W. Betebenner dbetebenner@nciea.org, and Ben Domingue ben.domingue@gmail.com
See Also
Examples
## Not run:
## prepareSGP is Step 1 of 5 of abcSGP
Demonstration_SGP <- prepareSGP(sgpData_LONG)
## Running prepareSGP on an already create SGP object as part of a annual update
Demonstration_SGP <- prepareSGP(Demonstration_SGP)
## Running prepareSGP on a long data set without creating addition variables
Demonstration_SGP <- prepareSGP(sgpData_LONG, create.additional.variables=FALSE)
## End(Not run)