defactorize | R Documentation |
Looks at each column in a data.frame, and converts factors to character vectors.
defactorize(df)
df |
a data.frame |
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.
Returns a data.frame where every factor column has been converted to a character vector.
This function simplifies editing data.frames by allowing users to edit character columns (which have no levels constraints) and then converting the results to factors for modeling. It is often used in a cycle of
defactorize(df)
edit the columns as necessary to correct errors or simplify
factorize(df)
David W. Roberts droberts@montana.edu
factorize
data(brycesite)
brycesite <- defactorize(brycesite)
brycesite$quad[brycesite$quad=='bp'] <- 'BP'
brycesite <- factorize(brycesite)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.