This repository contains a pair of R-based text analysis projects focused on Twitter and social-media text mining. The scripts demonstrate common workflows for preprocessing text, extracting word frequencies, creating word clouds, and exploring sentiment and topic patterns.
Text_Mining_R/
├── LICENSE
├── README.md
├── Text_Analysis/
│ ├── Text_Analysis.R
│ ├── Tweets.csv
│ └── Text_Analysis_Figures/
├── Text_Mining/
│ ├── Text_Mining.R
│ ├── twitter_data.csv
│ └── Text_Mining_Figures/
└── .gitignore
The Text_Analysis folder contains a larger airline tweet analysis workflow. It explores:
- loading tweet data from CSV
- text cleaning and preprocessing
- complaint vs. non-complaint classification
- word frequency analysis
- sentiment analysis using lexicons such as
nrc,afinn, andbing - topic modeling with LDA
- plot generation for finding patterns in airline-related social posts
Run it from the repository root with:
setwd("Text_Analysis")
source("Text_Analysis.R")The Text_Mining folder contains a focused text-mining tutorial using the tm and qdap packages. It covers:
- corpus creation from vectors and data frames
- text cleaning, stop-word removal, and stemming
- term-document and document-term matrices
- term frequency summaries
- word clouds and color palette examples
- visual exploration of frequent terms in tweets
Run it from the repository root with:
setwd("Text_Mining")
source("Text_Mining.R")This project uses R and the following packages:
install.packages(c(
"tm",
"qdap",
"wordcloud",
"RColorBrewer",
"tidyverse",
"tidytext",
"topicmodels",
"viridisLite"
))- The scripts are educational and exploratory in nature.
- Generated plots and figure outputs are saved in the corresponding
*_Figuresfolders. - The exact results may vary depending on package versions, text preprocessing decisions, and the dataset used.
This project is licensed under the MIT License. See the LICENSE file for details.