i
Exploring R
Evolution of R
Programming Features of R
R for Machine Learning
R for Data Analysis
Application of R
R vs. Python vs. SAS
R vs. Excel vs.Tableau
Install R base on Windows
Install R Studio on Windows
Install R base on Ubuntu
Install R Studio on Ubuntu
R Starter
First R Program
Working with R Packages
R Workplace and R Sessions
Manage working directory
Customize R studio
RStudio Debugger
RStudio History and Environment variables
R Syntax
R Variables
R Data Types & Structures
R Arithmetic Operators
R Logical Operators
R If Statement
R - If…Else Statement
If…else if…Else Statement
R for loop
R while loop
R repeat loop
R String Construction
R String Manipulation Functions
Creating Character Strings
R Functions
R built-in functions
Working with Vector
R Vector Indexing
R Vector Modification
R Arithmetic Vector Operations
R Lists
Access List elements (List Slicing)
List modification
R Matrix construction
Access Matrix elements
R Matrix Modification
R Matrix Operations
R Array Construction
Accessing Array Elements
Manipulating Array Elements
R Data Frames
Data Extraction
Data Frame Expansion
R Built-in Data frames
R Factors
Manage Factor levels
Factor Functions
R Contingency Tables
R Data Visualization
R – Charts and Graphs
R Density Plot
R Strip Charts
R Boxplots
R Violin Plots
R Bar Charts
R Pie Charts
R Area Plots
R Time Series
Graphics with ggplot2
Ggplot2 Structure
ggplot2 Bar Charts
ggplot2 Pie Chart
ggplot2 Area Plot
ggplot2 Histogram
ggplot2 Scatter Plot
ggplot2 Box Plot
Mean & Median
Standard Deviation
Normal Distribution
Correlation
T-Tests
Chi-Square Test
ANOVA Test
Survival Analysis
Data Pre-processing and Missing Value Analysis
Missing data treatment
Missing value analysis with mice package
Outlier Analysis
Problems with outliers
Outlier Detection
Outlier Treatment
Simple Linear Regression
Mathematical Computation
Linear Regression in R
A complete Simple Regression Analysis
Multiple Linear Regression
Mathematical Analysis
Model Interpretation
A complete Multiple Regression Analysis
Logistic Regression
Mathematical Computation in R
Logistic Regression in R
Heart Risk Analysis using LR
Support Vector Machine
Heart Risk Analysis using SVM
Decision Trees
Random Forest
K means Clustering
Big data Analytics using R-Hadoop
RHADOOP Packages:
rJava: Low-Level R to Java Interface
rhdfs: Integrate R with HDFS
rmr2: MapReduce job in R
plyrmr: Data Manipulation with MapReduce job
rhbase: Integrate HBase with R
Environment setup for RHADOOP
Getting Started with RHADOOP
Categorical data
R factors are variables that take a limited number of different values. Hence these variables are often known as categorical variables. In order to categorize the data and store it on multiple levels, we use the data object called the R factor. They can store both strings and integers. They are also useful in the columns which have a limited number of unique values.
Create a Factor
In order to create an R factor, we will make use of the factor () function. It contains data, levels, labels, exclude, ordered, and nmax as arguments. Only data is mandatory; others are optional.
Factor Syntax:
Create a factor data set:
To create a factor, we can only take the data, keeping others as default. We have initialized a variable (department) with a character vector of four elements. If we want to create a factor data, we have to use this department data s argument.
We can use levels and labels arguments per our requirement. In the following example, we are initializing four levels Male, Man, Lady, Female, and assigning their corresponding labels as Male and Female only. So, all the Male and Man will be labeled by Male, and Lady and Female will be labeled as Female.
Create a Factor from Data frame:
We can define a character variable as factor data directly from the data frame. In data.frame() function, there is an argument stringsAsFactors. If we use it default or true, all the character variables will be converted as a factor.
In this example, our Dept variable contains character data. As we used stringsAsFactors as TRUE, this variable will be converted into factor. If we display this, it will be presented with the factor with four levels.
Don't miss out!