R-Opitools – An Opinion Analytical Tool for Big Digital Text Document (DTD)

R-Opitools – An Opinion Analytical Tool for Big Digital Text Document (DTD) - Published in JOSS (2021)

https://github.com/manalytics/opitools

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
  • Committers with academic emails
    2 of 5 committers (40.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software
Last synced: 6 months ago · JSON representation

Repository

An R-package for opinion analysis of social media data

Basic Info
  • Host: GitHub
  • Owner: MAnalytics
  • License: gpl-3.0
  • Language: HTML
  • Default Branch: main
  • Size: 8.22 MB
Statistics
  • Stars: 12
  • Watchers: 1
  • Forks: 6
  • Open Issues: 0
  • Releases: 1
Created about 5 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Changelog License Code of conduct

README.md

"Opitools"

An R-package for analyzing Opinions in Big Digital Text Document (DTD)

Description

The opitools is an R package for exploring a digital text document (DTD) as well as performing the impact analysis of the opinions expressed by the DTD. The package is particularly suited for opinion-based DTD, such as individual-level posts (e.g. commentaries on Twitter or Facebook) and comments (as in an online product reviews). First, an exploratory function word_imp can be used to identify words relating to different themes (or subjects) that are referenced in a DTD. The opi_impact function can then be utilized to investigate whether an identified/specified theme (or subject) impacts the overall opinion expressed by the document. The potentials of opitools for application across a wide range of domains is described briefly here (see the vignette for details).

Click here to visit the built website for the package.

Installation from CRAN

From an R console, type:

```{r}

install.packages("opitools")

library(opitools)

```

To install the developmental version of the package, type: remotes::install_github("MAnalytics/opitools"). (Note: remotes is an extra package that needed to be installed prior to the running of this code).

Please, report any installation problems in the issues.

Example usage

Below is an example usage of how opitools can be employed to identify themes (or subjects) from a DTD and then deployed to perform opinion impact analysis.

Importing the dataset

The policing_dtd - a DTD comprising Twitter posts about police/policing in a neighbourhood, will be used in this demonstration.

```r

data(policing_dtd)

```

Identify themes (subjects)

Utilize word_imp function to highlights terms or words in accordance to their importance in the DTD. Through visual inspection, collate related terms or words that denote specific theme or subject from the generated wordcloud. Several words relating to the COVId-19 pandemic, including 'infect', 'pandemic', and 'lockdown' can be identified as been important in the document. These words are provided as covid_theme in the package. The function can be ran as follows (see the documentation for details):

```r

p1a <- wordimp(textdoc = policingdtd, metric= "tf", wordstofilter=c("police","policing"))

Note: policing_dtd is a dataframe

```

Impact analysis

The impact analysis can be conducted as follows:

```r

Running the analysis

results <- opiimpact(textdoc = policingdtd, themekeys=covidtheme, metric = 1, fun = NULL, nsim = 99, alternative="two.sided", quiet=FALSE)

Note: policing_dtd is a dataframe

print(results)

$test [1] "Test of significance (Randomization testing)"

$criterion [1] "two.sided"

$exp_summary Min. 1st Qu. Median Mean 3rd Qu. Max. -8.240 -5.880 -5.880 -5.028 -3.530 -1.180

$p_table

|observedscore |Sbeat |nsim |pvalue |signif | |:--------------|:------|:----|:-------|:------| |-5.88 |56 |99 |0.52 |' |

$p_key [1] "0.99'" "0.05" "0.025" "0.01**"

$pformula [1] "(Sbeat + 1)/(nsim + 1)"

......

```

The research question of the analysis above can be stated as follows:

RQ1: "Does COVID-19 pandemic influence public opinion on neighourhood policing?"

The output shows an overall negative opinion (-5.88) of the public on the neighbourhood policing, and that the pandemic has not had a significant impacts (pvalue = 0.52) on the opinion expressed by the public. (More detailed explanation can be found in the study adepeju, M. and Jimoh, F. (2021)).

Other applications

Table 1 summarizes the analysis using different example datasets provided in the package. The output from the law enforcement application (as in above) is entered in the first row of the table. Other research questions investigated are as follow:

RQ2: "How does the democratic candidate (Hillary Clinton) affects viewers’ opinion of the presidential debate?"

RQ3a: "Do the refreshment outlets/items impact customers’ opinion of the Piccadilly train services?"

RQ4b: "Do the signages influence customers’ opinion of the Piccadilly train services?"

Table 1. Impact analysis results

```r | RQs | Primary data | Themekeys | Score function | Observed Score (S) | P-value | |:-----: | :----------: | :---------------: | :---------------:| :-----------------:| :---------:| | RQ1 | policingdtd | covidtheme | 'Polarity score' | -5.88 | 0.52 | | RQ2 | debatedtd | direct input | 'Polarity score' | -0.33 | 0.93 | | RQ3a | reviewsdtd | refreshmenttheme | 'Polarity score' | 67.92 | 0.01 | | RQ3b | reviewsdtd | signagetheme | 'Polarity score' | 67.92 | 0.1 |

```

In each example, the same opinion score function is employed (metric = 1, i.e. the polarity score = (P - N)/(P + N)*100, where P and N represent positive and negative sentiments, respectively). See the documentation for details. Employing a threshold of p=0.05, any p-values less or equal to the threshold (e.g. RQ3a) represent a significant impact of the specified theme (i.e. refreshment_theme) on the overall opinion score computed based on the reviews_dtd.

References

  1. Adepeju, M. and Jimoh, F. (2021). An Analytical Framework for Measuring Inequality in the Public Opinions on Policing – Assessing the impacts of COVID-19 Pandemic using Twitter Data. click here:

Code of Conduct

Please note that the opitools package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Owner

  • Name: Monsuru Adepeju
  • Login: MAnalytics
  • Kind: user
  • Location: Manchester
  • Company: Manchester Metropolitan University

I specialize in Geocomputation, Big (Crime and Police) Data Analytics, and GIS Application Development.

JOSS Publication

R-Opitools – An Opinion Analytical Tool for Big Digital Text Document (DTD)
Published
August 31, 2021
Volume 6, Issue 64, Page 3605
Authors
Monsuru Adepeju ORCID
Crime and Well-being Big Data Centre, Manchester Metropolitan University, United Kingdom
Editor
Andrew Stewart ORCID
Tags
digital text document sentiment analysis opinion mining randomization testing

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 388
  • Total Committers: 5
  • Avg Commits per committer: 77.6
  • Development Distribution Score (DDS): 0.155
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
geoMADE g****d@l****k 328
MAnalytics m****u@m****k 52
cbarrie6 c****e@g****m 5
Andrew Stewart d****t@g****m 2
Justin Ho z****4@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 4
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 1.33
  • Average comments per pull request: 0.25
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jaeyk (1)
  • justinchuntingho (1)
  • MAnalytics (1)
Pull Request Authors
  • ajstewartlang (2)
  • justinchuntingho (1)
  • cjbarrie (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 186 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: opitools

Analyzing the Opinions in a Big Text Document

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 186 Last month
Rankings
Forks count: 9.1%
Stargazers count: 15.1%
Dependent packages count: 29.8%
Average: 32.8%
Dependent repos count: 35.5%
Downloads: 74.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.0.0 depends
  • cowplot * imports
  • dplyr * imports
  • forcats * imports
  • ggplot2 * imports
  • likert * imports
  • magrittr * imports
  • purrr * imports
  • stringr * imports
  • tibble * imports
  • tidyr * imports
  • tidytext * imports
  • tm * imports
  • wordcloud2 * imports
  • kableExtra * suggests
  • knitr * suggests
  • markdown * suggests
  • rmarkdown * suggests
  • rvest * suggests
  • testthat * suggests