Skip to content

Commit

Permalink
Merge pull request #12 from como-ph/v0.2.0
Browse files Browse the repository at this point in the history
V0.2.0
  • Loading branch information
ernestguevarra authored May 23, 2020
2 parents c9089a9 + b856e4a commit 2209b4a
Show file tree
Hide file tree
Showing 77 changed files with 3,603 additions and 491 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
^\.travis\.yml$
^appveyor\.yml$
^codecov\.yml$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
80 changes: 80 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'devel'}
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
46 changes: 46 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: test-coverage

jobs:
test-coverage:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

export(combine_docs)
export(combine_iatf)
export(get_dfa_links)
export(get_doh_links)
export(get_doh_release)
export(get_iatf_links)
export(get_pr_url)
export(get_press_release)
importFrom(httr,user_agent)
importFrom(lubridate,dmy)
importFrom(lubridate,mdy)
importFrom(magrittr,"%>%")
importFrom(rvest,html_attr)
Expand All @@ -27,3 +31,4 @@ importFrom(tibble,tibble)
importFrom(utils,data)
importFrom(utils,download.file)
importFrom(xml2,read_html)
importFrom(xml2,url_absolute)
13 changes: 12 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# comotext 0.1.0
## comotext v0.2.0

* created new versions of `get_` functions to allow for naming of source of text data; deprecation process started on previous versions

* re-structured the output text tibbles from the functions to a more logical sequence of data columns with a general sequence of `linenumber`, `identifier`, `text`, `date`, `source`, `type`, `url` whichever is present for the given tibble

* converted URLs to absolute URLs rather than relative URLs

* renamed datasets to include source of data as prefix to the name


# comotext v0.1.0

* Created pull data functions for the Department of Health (DoH) press releases found at [https://www.doh.gov.ph/press-releases](https://www.doh.gov.ph/press-releases)

Expand Down
9 changes: 7 additions & 2 deletions R/01-get_iatf.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ get_iatf_links <- function(base = "https://www.doh.gov.ph/COVID-19/IATF-Resoluti
id <- stringr::str_extract(string = id, pattern = "[0-9]+")

## Add links id to links
yy <- data.frame(id, link = yy, stringsAsFactors = FALSE)
yy <- data.frame(id,
source = "IATF",
type = "resolution",
link = yy,
stringsAsFactors = FALSE)

## Merge links with page table
linkTable <- merge(xx[[1]], yy, by.x = "Resolution No.", by.y = "id")
names(linkTable) <- c("id", "title", "date", "link")

names(linkTable) <- c("id", "title", "date", "source", "type", "url")

## Convert to tibble
linkTable <- tibble::tibble(linkTable)
Expand Down
Loading

0 comments on commit 2209b4a

Please sign in to comment.