powered by
Converts a data.frame of factors to integers.
data.frame
factor
as_integer(x, cols = NULL, fun = as.integer)
Returns a data.frame equal to the class of x with integer columns rather than factor.
class
x
A data.frame of factors.
Numeric indices of the columns to incude (use - to exclude as well). Default is to assign random NAs to all columns except the first column.
-
NA
An as. coercion function to apply to each column. Default is as.integer.
as.
as.integer
r_series
as_integer(r_series(likert_7, 5, 10)) as_integer(r_series(likert_7, 5, 10), cols = c(2, 4)) library(dplyr) r_data_frame(n=100, age, political, sex, grade ) %>% as_integer(2:3)
Run the code above in your browser using DataLab