Top "R-factor" questions

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

list all factor levels of a data.frame

with str(data) I get the headof the levels (1-2 values) fac1: Factor w/ 2 levels ... : fac2: Factor w/ 5 levels ... : fac3: …

r dataframe r-factor
Concatenate rows of a data frame

I would like to take a data frame with characters and numbers, and concatenate all of the elements of the …

r vector concatenation paste r-factor
Convert Factor to Date/Time in R

This is the information contained within my dataframe: ## minuteofday: factor w/ 89501 levels "2013-06-01 08:07:00",... ## dDdt: num 7.8564 2.318 ... ## minutes: POSIXlt, format: NA …

r date posixct r-factor posixlt
Why use as.factor() instead of just factor()

I recently saw Matt Dowle write some code with as.factor(), specifically for (col in names_factors) set(dt, j=…

r r-factor
How to change order of boxplots when using ggplot2?

This question follows from this other one. I was unable to implement answers there. Define: df2 <- data.frame(…

r ggplot2 boxplot r-factor
Sort data frame column by factor

Supose I have a data frame with 3 columns (name, y, sex) where name is character, y is a numeric value …

r sorting r-factor
Change stringsAsFactors settings for data.frame

I have a function in which I define a data.frame that I use loops to fill with data. At …

r dataframe default options r-factor
How to convert factor format to numeric format in R without changing the values?

Below is dataframe df1 of which I want to convert column "V2" from factor format to numeric without changing the …

r numeric r-factor
How do I get discrete factor levels to be treated as continuous?

I have a data frame with columns initially labeled arbitrarily. Later on, I want to change these levels to numerical …

r ggplot2 dataframe r-factor
Logistic Regression on factor: Error in eval(family$initialize) : y values must be 0 <= y <= 1

Not able to fix the below error for the below logistic regression training=(IBM$Serial<625) data=IBM[!training,] dim(…

r logistic-regression r-factor