analyze_sentiment: BBC News article Sentiment analysis

Description Usage Arguments Details Value Note Examples

View source: R/AnalyzeSentiment.R

Description

Analyze sentiment distribution across the article and plot it

Usage

1

Arguments

url_end

a character string, an ending part of BBC News particular atricle URL (everything after https://www.bbc.com/news/). For example, article URL is "https://www.bbc.com/news/world-us-canada-51381625". Only "world-us-canada-51381625" should be pasted

Details

Use Corpus with article text without cleaning it as punctuation and stopwords should be preserved. Transform Corpus into a dataframe with one row for each article paragraph. Calculate sentiment score for each dataframe row and summary statistics for the entire article sentiment (mean, median, min, max). Build a dataframe with sentiment disrtibution and plot it

Value

gg_plot with sentiment distibution across the article (sentiment > 0 positive and blue in color; sentiment < 0 negative and red in color)

Note

Please, check that URL (url_end) exists before running the function, otherwise you will get an "Error in open.connection(x, "rb") : HTTP error 404". Please, insert URLs of the articles in English only. Only for BBC News, not BBC Sports , Travel, Worklife, etc.

Examples

1
2
analyze_sentiment("world-us-canada-51381625")
analyze_sentiment("entertainment-arts-35232060")

unimi-dse/1ed5ff0d documentation built on Feb. 10, 2020, 12:21 a.m.