Learn R Programming

labdsv (version 2.0-1)

defactorize: Change Factors in Data.frames to Character Vectors

Description

Looks at each column in a data.frame, and converts factors to character vectors.

Usage

defactorize(df)

Value

Returns a data.frame where every factor column has been converted to a character vector.

Arguments

df

a data.frame

Details

The function simply scans each column in a data.frame looking for factor columns. For each factor column it calls the ‘as.character()’ function to convert the column to a character vector.

See Also

factorize

Examples

Run this code
data(brycesite)
brycesite <- defactorize(brycesite)
brycesite$quad[brycesite$quad=='bp'] <- 'BP'
brycesite <- factorize(brycesite)

Run the code above in your browser using DataLab