Search
 
SCRIPT & CODE EXAMPLE
 

R

How to Convert a Factor in R

> directions <- c("North", "East", "South", "South")
> directions.factor <- factor(directions)
> directions.factor
[1] North East South South
Levels: East North South
Comment

r convert to factor

# Convert character column to factor
data$x <- as.factor(data$x)
Comment

PREVIOUS NEXT
Code Example
R :: how to return the date with only the day in it in r 
R :: how to create dictionary in R 
R :: combine columns in r 
R :: r - transform as factor 
R :: if not NA in r 
R :: filter date in r 
R :: how to read in txt/csv files into r 
R :: show 2 ggplots together 
R :: vars() in R 
R :: create vector in r 
R :: R squared regression in r with ggplot 
R :: plot porportion bar chart in r 
R :: r string split 
R :: change labels in legend R 
R :: ggplot categorical data r 
R :: count r 
R :: R create sequence of date each quarters 
R :: generate bin frequency table in R 
R :: distance matrix in r 
R :: how to exclude inf in r 
R :: how to count the number of non NA values in R 
R :: meaning of %% R 
Rust :: rustlang error: linker `link.exe` not found 
Rust :: rust concatenate vectors 
Rust :: read file rust 
Rust :: rust option 
Rust :: rust•armanriazi•borrowchecker•lifetime 
Rust :: armanriazi•rust•unsafe•rawpointer 
Rust :: armanriazi•rust•union 
Rust :: Counting bits Kernighan style 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =