recode.sdf: Recode Levels Within Variables

View source: R/recode.sdf.R

recode.sdfR Documentation

Recode Levels Within Variables

Description

Recodes variables in an edsurvey.data.frame, a light.edsurvey.data.frame, or an edsurvey.data.frame.list.

Usage

recode.sdf(x, recode)

Arguments

x

an edsurvey.data.frame, a light.edsurvey.data.frame, or an edsurvey.data.frame.list

recode

a list of recoding rules. See Examples for the format of recoding rules.

Value

an object of the same class as x with the recode added to it

Author(s)

Trang Nguyen and Paul Bailey

Examples

## Not run: 
# filepath argument will vary by operating system conventions
usaG4.15 <- readTIMSS("~/TIMSS/2015", "usa", 4)
d <- getData(usaG4.15, "itsex")
summary(d) #show details: MALE/FEMALE
usaG4.15 <- recode.sdf(usaG4.15,
                       recode = list(itsex=list(from=c("MALE"),
                                                to=c("BOY")),
                                     itsex=list(from=c("FEMALE"),
                                                to=c("GIRL"))))

d <- getData(usaG4.15, "itsex") #apply recode
summary(d) #show details: BOY/GIRL

## End(Not run)

EdSurvey documentation built on Nov. 2, 2023, 6:25 p.m.