Opens a connection to a NAEP data file residing
on the disk. Returns an edsurvey.data.frame with
information about the file and data.
Usage
readNAEP(
path,
defaultWeight = "origwt",
defaultPvs = "composite",
omittedLevels = c("Multiple", NA, "Omitted"),
frPath = NULL,
xmlPath = NULL
)Arguments
- path
a character value indicating the full filepath location and name of the (.dat) data file
- defaultWeight
a character value that indicates the default weight specified in the resulting
edsurvey.data.frame. Default value isorigwtif not specified.- defaultPvs
a character value that indicates the default plausible value specified in the resulting
edsurvey.data.frame. Default value iscompositeif not specified.- omittedLevels
a character vector indicating which factor levels/labels should be excluded. When set to the default value of
c('Multiple',NA,'Omitted'), adds the vector to theedsurvey.data.frame.- frPath
a character value indicating the file location of the
.fr2parameter layout file included with the data companion to parse the specifiedpathdata file. The default value ofNULLwill attempt to search the parent directory for the corresponding.fr2file for the specifiedpathdata file.- xmlPath
a character value indicating the file path of the
.xmlparameter layout file included as part of the NAEPEX companion. This file provides necessary information required to read and parse the (.dat) data file. The default value ofNULLwill attempt to search the parent directory for the corresponding.xmlfile for the specifiedpathdata file.
Details
The frPath file layout information will take precedence over the xmlPath file when the xmlPath is not explicitly set, or when the xmlPath file cannot be located.
The readNAEP function includes both scaled scores and theta scores, with the latter having names ending in \_theta.
When a NAEP administration includes a linking error variable those variables are included and end in _linking.
When present, simply use the _linking version of a variable to get a standard error estimate that includes linking error.
This function supports the following NAEP data products:
Main NAEP
Long-Term Trend NAEP (LTT)
Monthly School Survey Linking Study (MSS)
COVID Data Hub School Linking Study
School and Teacher Questionnaire Special Study (STQ)
A table outlining the differences between the Main NAEP and Long-Term Trend (LTT) datasets can be found on the NAEP Nations Report Card website.
For the School and Teacher Questionnaire Special Study (STQ), the School level data can be analyzed independently, or merged together with the Teacher level data. The chosen variables will dynamically link the data when applicable.
Some School records may not have any Teacher records and thus the dimensions of the resulting edsurvey.data.frame may not match the total teacher record count.
Examples
if (FALSE) { # \dontrun{
# read in the example data (generated, not real student data)
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
sdf
# To read in an NCES file first set the directory to the /Data subfolder,
# then read in the appropriate .dat file:
setwd("location/of/Data")
sdf <- readNAEP(path="M36NT2PM.dat")
# Or read in the .dat file directly through the folder pathway:
sdf <- readNAEP(path="location/of/Data/M36NT2PM.dat")
} # }