Why Text Processing is Common
📖 Scenario: Imagine you work at a company that collects customer feedback through online reviews. These reviews are written in plain text. To understand what customers like or dislike, you need to process this text data.
🎯 Goal: You will create a simple R program that stores some customer reviews, sets a keyword to search for, counts how many reviews contain that keyword, and then prints the count. This shows why text processing is common: to find useful information in written data.
📋 What You'll Learn
Create a vector called
reviews with exactly these three strings: "Great product, fast delivery", "Poor packaging, but good quality", "Excellent customer service"Create a variable called
keyword and set it to the string "good"Use a
for loop with the variable review to go through each element in reviewsInside the loop, check if
keyword is found in review using grepl()Create a variable called
count to keep track of how many reviews contain the keywordPrint the final value of
count💡 Why This Matters
🌍 Real World
Companies often collect customer feedback, social media posts, or product reviews as text. Processing this text helps find common opinions or problems quickly.
💼 Career
Text processing skills are useful for jobs in data analysis, marketing, customer support, and anywhere understanding written feedback or documents is important.
Progress0 / 4 steps