Top "R-factor" questions

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

Converting a factor with 2 levels to binary values 0/1 in R

I have a variable, called gender, with binary categorical values "female"/"male". I want to change its type to integers 0/1 …

r binary r-factor
ggplot: arranging boxplots of multiple y-variables for each group of a continuous x

I would like to create boxplots of multiple variables for groups of a continuous x-variable. The boxplots should be arranged …

r ggplot2 boxplot continuous r-factor
Convert factor to integer in a data frame

I have the following code anna.table<-data.frame (anna1,anna2) write.table<-(anna.table, file="anna.…

r integer dataframe text-files r-factor
Cleaning up factor levels (collapsing multiple levels/labels)

What is the most effective (ie efficient / appropriate) way to clean up a factor containing multiple levels that need to …

r r-factor r-faq
Sort a factor based on value in one or more other columns

I've looked through a number of posts about ordering factors, but haven't quite found a match for my problem. Unfortunately, …

r r-factor
How to convert a character vector to numeric?

I have this character vector but I need to convert this to numeric. >iono_test_y [1] "g" "b" "b" "…

r numeric r-factor
How to convert factor levels to list, in R

Imagine a data frame such as df1 below: df1 <- data.frame(v1 = as.factor(c("m0p1", "m5…

r list dataframe r-factor
How can i convert a factor column that contains decimal numbers to numeric?

I have a csv file and when i use this command SOLK<-read.table('Book1.csv',header=TRUE,sep=…

r dataframe numeric r-factor
How to concatenate factors, without them being converted to integer level?

I was surprised to see that R will coerce factors into a number when concatenating vectors. This happens even when …

r concatenation r-factor
Using ifelse on factor in R

I am restructuring a dataset of species names. It has a column with latin names and column with trivial names …

r if-statement r-factor