Learn R Programming

EdSurvey (version 1.0.6)

isWeight: Return a value indicating whether a variable is a weight on an edsurvey.data.frame or light.edsurvey.data.frame.

Description

For an edsurvey.data.frame or light.edsurvey.data.frame, return a value indicating whether a variable is a weight.

Usage

isWeight(var, data)

Arguments

var

character indicating the variable in question.

data

an edsurvey.data.frame or light.edsurvey.data.frame.

Value

A boolean (or vector when var is a vector) indicating if each element of var are weights.

Details

Note that this function returns TRUE only when var is the name of the weight used for making estimates, not if the var is one of the individual jackknife replicates.

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"))

# True
isWeight(var="origwt", data=sdf)

# False
isWeight(var="dsex", data=sdf)
# }

Run the code above in your browser using DataLab