View source: R/factor.data.frame.R
factor.data.frame | R Documentation |
factor.data.frame()
turns character columns in a data frame into
factor columns and refactorises factor columns, silently dropping unused
levels.
factor.data.frame(df, ...)
factor.data.frame_(df, .dots)
df |
A data frame. |
... |
Column names to factorise. |
.dots |
Character vector of column names to factorise. |
A data frame.
Michaja Pehl
character.data.frame()
require(dplyr)
(df <- tibble(
char = letters[1:3],
fact = factor(LETTERS[24:26], levels = LETTERS[c(1:3, 24:26)]),
num = (1:3) ^ 2))
str(factor.data.frame(df))
str(factor.data.frame_(df, 'num'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.