as.afactor {RelativeRisk}R Documentation

As a factor

Description

Changes columns of a data frame into factors

Usage

        as.afactor(cName,data,levOrder,curLevs)

Arguments

cName The quoted column name to change
data A data frame, or matrix.
levOrder The desired ordering of the levels.
curLevs The current levels in the same order as in levOrder

Details

Makes the column with name cName into a factor.

if levOrder is present, these will be the levels of the factor. When curLevs is missing,the values in levOrder must be the complete set of unique values in the cName columnn.

If curLevs is present, the levOrder values will be mapped into them in the cName column; that is, if curLevs=1:3, and levOrder=c("a","c","b") then any value 2 in the cName column will be replaced by "c".

Value

A data frame with changes in the column cName.

Author(s)

Bob Wheeler bwheelerg@gmail.com

Please cite this program as follows:

Wheeler, R.E. (2009). as.afactor RelativeRisk. The R project for statistical computing http://www.r-project.org/


[Package RelativeRisk version 1.1-1 Index]