readNAEP: Connect to NAEP Data

View source: R/readNAEP.r

readNAEPR Documentation

Connect to NAEP Data

Description

Opens a connection to a Main NAEP, or Long-Term Trend 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 is origwt if not specified.

defaultPvs

a character value that indicates the default plausible value specified in the resulting edsurvey.data.frame. Default value is composite if 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 the edsurvey.data.frame.

frPath

a character value indicating the file location of the .fr2 parameter layout file included with the data companion to parse the specified path data file. The default value of NULL will attempt to search the parent directory for the corresponding .fr2 file for the specified path data file.

xmlPath

a character value indicating the file path of the .xml parameter 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 of NULL will attempt to search the parent directory for the corresponding .xml file for the specified path data 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 both the Main NAEP data files, and Long-Term Trend NAEP data files. A table outlining the differences can be found on the NAEP Nations Report Card website.

Value

An edsurvey.data.frame for a NAEP data file.

Author(s)

Tom Fink and Ahmad Emad

See Also

edsurvey.data.frame getData

Examples

## Not run: 
# 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")

## End(Not run)

EdSurvey documentation built on June 27, 2024, 5:10 p.m.