I have the following dataframe and I want to standardise the description in the desc column. If desc contains some permutation of 'employee', to output desc1 as Employment size. And if desc contains some permutation of 'Year', to output desc1 as Year.
How can I do this in R?
desc <- c('Total number of employees','Employees size','Employee','No. of employees','Others')
value <- c(200,14035,155,663,25626)
emp_data <- data.frame(desc,value)
The output dataframe should look like this:
desc <- c('Total number of employees','Employees size','Employee','No. of employees','Others','Years','Year','Yr')
value <- c(200,14035,155,663,25626)
desc1 <- c('Employment size','Employment size','Employment size','Employment size','','Year','Year','Year')
emp_data <- data.frame(desc,value,desc1)
Aucun commentaire:
Enregistrer un commentaire