GithubHelp home page GithubHelp logo

yingjie4science / sdgdetector Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 1.0 8.18 MB

A novel R package that can identify and visualize 17 Sustainable Development Goals and associated 169 Targets in text

License: GNU General Public License v3.0

R 90.04% TeX 9.96%
r-package sdg sdgs sustainable-development-goals text-mining cran r sustainability

sdgdetector's Introduction

DOI CRAN_Status_Badge License: GPL v3 CRAN downloadcount CRAN downloadcount Visitor Badge

SDG Detector

In 2015, leaders worldwide adopted 17 Sustainable Development Goals (SDGs) with 169 targets to be achieved by 2030 (https://sdgs.un.org). The framework of SDGs serves as a blueprint for shared prosperity for both people and the earth. SDGdetector identifies both direct and indirect expressions of SDGs and associated targets in chunks of text. It takes a data frame with a specified column of text to process as inputs, and outputs a data frame with original columns plus matched SDGs and targets.

For Python package, check seesus.

Installation

There are two ways to install the SDGdetector R package.

1. CRAN

SDGdetector is now available on CRAN, so you can install it with:

install.packages("SDGdetector")

2. GitHub

You can alternatively install the development version of SDGdetector from GitHub as follows:

if (!require("remotes")) {
  install.packages("remotes")
}

remotes::install_github("Yingjie4Science/SDGdetector")

Example Usage

To detect SDGs from text

library(SDGdetector)

### string as input data
text <- 'our goal is to mitigate climate change, end poverty, and reduce inequality globally'
SDGdetector(x = text)

### dataframe as input data
df <- data.frame(col = c(
  'our goal is to end poverty globally', 
  'this product contributes to slowing down climate change'))
SDGdetector(x = df, col = col)

To detect regions/countries in text

x = 'China and USA devoted the largest efforts on solar energy'
detect_region(x)

To use specific SDG colors

sdg_color(1)
sdg_color(x = 1:17)

To use specific SDG icons

sdg_icon(x = 7, res = 300)

To visualize SDG on a bar plot

data("sdgstat")
df <- sdgstat

# plot SDG on a bar plot
plot_sdg_bar(data = df, sdg = SDG, value = Value)

To visualize SDG on a map

# plot SDG by country on a map
plot_sdg_map(data = df, sdg = SDG, value = Value, country = Country, by_sdg = F)

Accuracy Evaluation

This package has achieved high accuracy in detecting SDG-related statements within textual data (> 75%, measured by the alignment between the R package results and four experts' manually-coded results; see this supplementary document for more information. The data and code for reproducing the performance metrics can be found in this repo under ./docs/accuracy_evaluation/.

The overall accuracy (left) and the accuracy for each round of inspection (right). The red squared dot in the left plot indicates the mean value and the hollow round dots represent the accuracy values reported by each expert.

License

The SDGdetector R package is distributed under the GNU General Public License v3.0.

How to Cite

Get citation information for SDGdetector in R doing citation(package = 'SDGdetector')

To cite SDGdetector in publications, please use:

Li, Y., Frans, V.F., Song, Y., Cai, M., Zhang, Y., Liu, J. (2023). SDGdetector: an R-based text mining tool for quantifying efforts toward Sustainable Development Goals. Journal of Open Source Software 8(84), 5124. https://doi.org/10.21105/joss.05124.

A BibTeX entry for LaTeX users is

  @Article{,
    title = {SDGdetector: an R-based text mining tool for quantifying efforts toward Sustainable Development Goals},
    author = {Yingjie Li and Veronica F. Frans and Yongze Song and Meng Cai and Yuqian Zhang and Jianguo Liu},
    journal = {Journal of Open Source Software},
    year = {2023},
    volume = {8},
    number = {84},
    pages = {5124},
    doi = {10.21105/joss.05124},
    url = {https://github.com/Yingjie4Science/SDGdetector}
  }

Reporting Bugs

SDGdetector is distributed as is and without warranty of suitability for application. If you encounter flaws with the software (i.e. bugs) please report the issue. Providing a detailed description of the conditions under which the bug occurred will help to identify the bug. Use the Issues tracker on GitHub to report issues with the software and to request feature enhancements.

sdgdetector's People

Contributors

caimeng2 avatar vffrans avatar yingjie4science avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

caimeng2

sdgdetector's Issues

JOSS Review

@Yingjie4Science Very excited to review your alls paper at JoSS and hope all is well - seems like things are going great.

JoSS wants related packages to be briefly discussed and differentiated ("Do the authors describe how this software compares to other commonly-used packages?") - what about adding a blurb (I think these can even be footnotes) regarding text2sdg and mentioning the differences?

JOSS Review - csaybar

Hi @Yingjie4Science,

I'm having a lot of struggle reviewing your package/paper. Sorry maybe is my fault (it's my first time as a JOSS reviewer 😬).
On the JOSS website it says Version: v0.1.0 (openjournals/joss-reviews#5124) but this version does not have the functionality you describe in the paper. It looks like a very early version of your package.

The latest version doesn't install on my computer.

remotes::install_github("Yingjie4Science/SDGdetector")
Warning in file(filename, "r", encoding = encoding) :
  cannot open file './Code/function_lookaround_nearby_n.R': No such file or directory
Error in file(filename, "r", encoding = encoding) : 
  cannot open the connection
ERROR: lazydata failed for packageSDGdetector

You should check this R file:

source('./Code/function_lookaround_nearby_n.R')

I would really appreciate a new release of SDGdetector with the code to review.

Best!

improvement

my_text <- data.frame(my_col=c('our goal is to end poverty globally', 'this product contributes to slowing down climate change'))
SDGdetector(my_text)

It doesn't work this way, but no error or warning is returned

Where does the "Value" Column in "sdgstat" comes from?

Thank you for creating an providing this super cool package!

Unfortunately I can´t perform all given functionalities on my own data.
If I run SDGdetector on my data, it returns a df with the the new column "sdg" where the identified SDGs are shown. But it doesn´t return the values described in the help function ("Data frame with the same information as df and 18 extra columns: 17 columns marking the number of occurrence of each of the 17 SDGs and one column match_detail listing details of specific targets.").

And where do I get the "Value" column from to perform plot_sdg_bar on my own data?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.