I have this data set which looks something like this.
This is my code
#set a variable to capture the path to this folder
path <- "C:/Users/PGO User/Desktop/Text Mining by GRC"
#set working directory
setwd(path)
read <- read.csv("sample.csv")
text2 <- read$text2
if(text2 == "No concern" | text2 == "No concern." | text2 == "No concerned" | text2 == "No concerns." | text2 == "No concerns") {
read$emotion <- "unknown"
read$polarity <- "neutral"
}else
{
read$emotion = emotion
read$polarity = polarity
}
write.csv(text2, file = "test1.csv", row.names = TRUE)
I actually thought of using if or if else statements to change the emotions and polarity in the csv file (see picture attached). The reason why I want to change the emotion and polarity is because some are not correct. So for example if under text2, it is "no concern", "no concerns", or "no concerned" it's emotion should be unknown and polarity should be neutral.
Can someone please help??
Aucun commentaire:
Enregistrer un commentaire