Text Cleaning in R

by

Clean your text data using below R code.

There is so many codes is available in R to clean the text, but its very easy method to clean text just run the below code select your file and code is give you a output.

Why we clean our text?

Data is the main part of the data science and without data, we can’t do anything in data science. So we need a lot of data for processing & prediction analysis. Here we need a proper clean data for better calculation and execution. This data cleaning & processing is also applied for the text data.
Here is the below condition for the text data
When we go to calculate the sentiment of the user comment or review we need clean data for the better result because customer adding the emoji in the text and we cant analysis symbol in text analysis so here we need the text without unwanted symbols for the better result. So, we need below code for the clean our whole customer reviews in quick time.


R Code


Import the Below Library

library(syuzhet)
library(tm)

Choose your txt or CSV  file by using choose.file function

data1 <- choose.files()

readLines function will read your data from file
text <- readLines(data1)

gsub function will remove all the unwanted symbols from the text
gsub(“[^\x01-\x7F]”, “”, text)

R will show you the output
print(text)

View your output in table format

view(text,”Table”)

You may also like