I have one data set.Which contain data about employees in company.You can see data below:
#Data
output_test<-data.frame(
Employees=c(1,2,3,10,15,122,143,150,250,300,500,1000)
)
So next steep should be classification. I need to classify Employees by size of company.Rule is that every number of Employees determine size of company.For example if number is below 10 that meaning that is "micro" company, if number is greater then 10 but below or equal to 50 company is "small" company.For "medium" company number of Employees is greater then 50 but equal or small to 250 and last is "large" company which have Employees greater then 250. In order to do this i wrote this line of code whit IF else statment
# Code
library(dplyr)
output_test_final<-output_test%>%
mutate(
Size= if(Employees>=10){
"Micro"
} else {
if(Employees>=50){
"Small"
} else {
if(Employees>=250){
"Medium"
} else {
"Large"
}
}
}
)
So results from this code are not good.So can anybody help me how to fix this code and get table like table below ?