Learn R Programming

Tmisc (version 0.1.22)

unfactor: Unfactor a data.frame

Description

Did you forget to pass stringsAsFactors=FALSE? This converts factor variables to characters in a dataframe.

Usage

unfactor(df)

Arguments

df

The dataframe you wish to change the factors into characters.

Value

A data.frame with factors converted to characters.

Examples

Run this code
# NOT RUN {
df <- data.frame(a = letters[1:5], x = 1:5, y = LETTERS[1:5], stringsAsFactors = TRUE)
str(df)
df <- unfactor(df)
str(df)
# }
# NOT RUN {
  
# }

Run the code above in your browser using DataLab