options(java.parameters = "- Xmx1024m") # Increases the size of exportable dataset, makes space
library(RSentiment)
library(dplyr)
gc() # Collects excess data
## used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 563068 30.1 1217327 65.1 1217327 65.1
## Vcells 1057794 8.1 8388608 64.0 1605504 12.3
setwd("C:\\Users\\Rhonda\\Desktop\\CC\\Thesis\\Analysis\\Content databases\\csv versions")
As the RSentiment package analyses all of the articles for sentiment analysis, the operator chose to include results=‘hide’ in the markdown process, otherwise the readout would include the entire content for the 748 articles analysed as part of this project. Copying the code from this document into R or RStudio will allow anyone to reproduce this process.
data <- read.csv("IT 1.csv")
IT1_sentiment <-calculate_sentiment(data$Full.text)
data2 <- read.csv("IT 2.csv")
IT2_sentiment <-calculate_sentiment(data2$Full.text)
data3 <- read.csv("IT 3.csv")
IT3_sentiment <-calculate_sentiment(data3$Full.text)
data4 <- read.csv("FJ_1.csv")
FJ1_sentiment <-calculate_sentiment(data4$Full.text)
data5 <- read.csv("FJ_2.csv")
FJ2_sentiment <-calculate_sentiment(data5$Full.text)
data6 <- read.csv("FJ_3.csv")
FJ3_sentiment <-calculate_sentiment(data6$Full.text)
data7 <- read.csv("Ind_1.csv")
Ind1_sentiment <-calculate_sentiment(data7$Full.text)
data8 <- read.csv("Ind_2.csv")
Ind2_sentiment <-calculate_sentiment(data8$Full.text)
data9 <- read.csv("Ind_3.csv")
Ind3_sentiment <-calculate_sentiment(data9$Full.text)
data10 <- read.csv("TJ_1.csv")
TJ1_sentiment <-calculate_sentiment(data10$Full.text)
data11 <- read.csv("TJ_2.csv")
TJ2_sentiment <-calculate_sentiment(data11$Full.text)
data12 <- read.csv("TJ_3.csv")
TJ3_sentiment <-calculate_sentiment(data12$Full.text)
RSentiment only runs 126 documents at a time. The ‘during’ portion of the Irish Times and the Irish Independent both exceed this (289 and 243 respectively). The missing documents were identifed and collated into new .csv files for analysis.
data13 <- read.csv("IT 2 Missing from RSentiment.csv")
ITmiss_sentiment <-calculate_sentiment(data13$Full.text)
data14 <- read.csv("Ind_2 Missing from RSentiment.csv")
IndMISS_sentiment <-calculate_sentiment(data14$Full.text)
Each dataframe can be viewed in RStudio. Contents of results were copied from this ‘view’ into an excel sheet for comparison with human analysis. This comparative analysis is discussed in chapter five of thesis (McGovern, 2018).
END.