In a data table, all the cells are numeric, and what i want do is to replace all the numbers into a string like this:
Numbers in [0,2]: replace them with the string "Bad"
Numbers in [3,4]: replace them with the string "Good"
Numbers > 4 : replace them with the string "Excellent"
Here's an example of my original table called "data.active":
My attempt to do that is this:
x <- c("churches","resorts","beaches","parks","Theatres",.....)
for(i in x){
data.active$i <- as.character(data.active$i)
data.active$i[data.active$i <= 2] <- "Bad"
data.active$i[data.active$i >2 && data.active$i <=4] <- "Good"
data.active$i[data.active$i >4] <- "Excellent"
}
But it doesn't work. is there any other way to do this?
EDIT
Here's the link to my dataset GoogleReviews_Dataset and here's how i got the table in the image above:
library(FactoMineR)
library(factoextra)
data<-read.csv2(file.choose())
data.active <- data[1:10, 4:8]