Top "R-factor" questions

The factor is a data type in the R language, used to encode categorical or enumerated data.

R how to change one of the level to NA

I have a data set and one of its column has factor levels "a" "b" "c" "NotPerformed". How can I …

r r-factor
Can we get factor matrices in R?

It seems not possible to get matrices of factor in R. Is it true? If yes, why? If not, how …

r matrix vector integer r-factor
How to read numeric values as factors in R?

I have a data frame A which has numeric column like: zip code 00601 00602 00607 and so on. If I read this …

r csv r-factor
how to convert numeric column to factor in R

I'm trying to use the softImpute command (from the softImpute package) for filling in missing values, and I'm trying to …

r numeric r-factor
Why does as.factor return a character when used inside apply?

I want to convert variables into factors using apply(): a <- data.frame(x1 = rnorm(100), x2 = sample(c("a","…

r apply r-factor
Replacing numbers within a range with a factor

Given a dataframe column which is a series of integers (age), I want to convert ranges of integers into ordinal …

r data-processing r-factor
Updating factor levels while filtering R data.frames

I have a data.frame similar to below. I pre-process it by deleting rows that I am not interested in. …

r dataframe r-factor
geom_boxplot() from ggplot2 : forcing an empty level to appear

I can't find a way to ask ggplot2 to show an empty level in a boxplot without imputing my dataframe …

r ggplot2 boxplot r-factor
Create frequency tables for multiple factor columns in R

I am a novice in R. I am compiling a separate manual on the syntax for the common functions/features …

r r-factor sapply