topcode.data: topcode a group of variables

View source: R/helper_functions.r

topcode.dataR Documentation

topcode a group of variables

Description

this function uses topcode.var to topcode a set of variables. it's useful for topcoding a whole set of aggregated relational data ("how many X are you connected to?") questions in the same way.

Usage

topcode.data(survey.data, vars, max, to.na = NULL, ignore = NA)

Arguments

survey.data

the dataset with the survey responses

vars

a vector with the names or indices of the columns in the dataframe that are to be topcoded

max

the maximum value; all values > max are recoded to max

to.na

a vector of values to recode to NA (this happens before topcoding)

ignore

a vector of values to leave unchanged

Value

the topcoded vector

Examples

## Not run: 
   data(hh.survey) # example data included with the package
   example.survey <- topcode.data(example.survey,
                                  vars=known.popn.vars,
                                  max=30)

## End(Not run)

dfeehan/networkreporting documentation built on May 17, 2023, 1:06 a.m.