Learn R Programming

EdSurvey (version 2.2.3)

readNAEP: Connect to NAEP Data

Description

Opens a connection to an NAEP data file residing on the disk and 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)

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 location of the fr2 parameter layout file included with the data companion to parse the specified filepath data file

Value

An edsurvey.data.frame containing the following elements:

userConditions

a list containing all user conditions set using the subset.edsurvey.data.frame method

defaultConditions

the default conditions to be applied to the edsurvey.data.frame

data

an LaF object containing a connection to the student dataset on disk

dataSch

an LaF object containing a connection to the school dataset on disk

dataTch

not applicable for NAEP data; returns NULL

weights

a list containing the weights found on the edsurvey.data.frame

pvvar

a list containing the plausible values found on the edsurvey.data.frame

subject

the subject of the dataset contained in the edsurvey.data.frame

year

the year of assessment of the dataset contained in the edsurvey.data.frame

assessmentCode

the code of the dataset contained in the edsurvey.data.frame

dataType

the type of data (whether student or school) contained in the edsurvey.data.frame

gradeLevel

the grade of the dataset contained in the edsurvey.data.frame

achievementLevels

default NAEP achievement cutoff scores

omittedLevels

the levels of the factor variables that will be omitted from the edsurvey.data.frame

fileFormat

a data.frame containing the parsed information from the student .fr2 file associated with the data

fileFormatSchool

a data.frame containing the parsed information from the school .fr2 file associated with the data

fileFormatTeacher

not applicable for NAEP data; returns NULL

survey

the type of survey data contained in the edsurvey.data.frame

Details

The function uses the frPath file layout (.fr2) data to read in the fixed-width data file (.dat), and builds the edsurvey.data.frame.

Examples

Run this code
# NOT RUN {
# read in the example data (generated, not real student data)
sdf <- readNAEP(system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
sdf

# }
# NOT RUN {
# 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")
# }

Run the code above in your browser using DataLab