Skip to content

Commit

Permalink
clean up documentation and create pkgdown site
Browse files Browse the repository at this point in the history
  • Loading branch information
ecophilina committed Oct 16, 2024
1 parent 0f067d9 commit d974d3a
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 109 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^data-raw$
^vignettes/get-all-cache
^vignettes/knitr-cache
^_pkgdown\.yml$
^docs$
^pkgdown$
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ inst/shortraker-kni*
figs/*
inst/pcod-vb.html
*~
*.dll
*.dll
docs
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ Suggests:
sf
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
URL: https://github.com/pbs-assess/gfdata
URL: https://github.com/pbs-assess/gfdata, https://pbs-assess.github.io/gfdata/
BugReports: https://github.com/pbs-assess/gfdata/issues
12 changes: 6 additions & 6 deletions R/correct-ssids.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' Custom fixes for problem surveys with shared trip ids resulting in assignment to wrong ssid
#'
#' @param dat df containing these columns: fishing_event_ids, survey_series_id, survey_id,
#' major_stat_area_code, minor_stat_area_code
#' @param specimens Defaults to FALSE where checks for duplication of fishing_event_ids
#'
# Custom fixes for problem surveys with shared trip ids resulting in assignment to wrong ssid
#
# @param dat df containing these columns: fishing_event_ids, survey_series_id, survey_id,
# major_stat_area_code, minor_stat_area_code
# @param specimens Defaults to FALSE where checks for duplication of fishing_event_ids
#
correct_ssids <- function(dat, specimens = FALSE) {
try(dat[dat$survey_series_id %in% c(6, 7), ]$survey_id <- NA, silent = TRUE)
try(dat[((dat$survey_series_id == 6 & dat$major_stat_area_code %in% c("03", "04"))), ]$survey_series_id <- 7, silent = TRUE)
Expand Down
12 changes: 6 additions & 6 deletions R/parent-level-counts.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' summarize sub/minor level counts from fishing event data at the parent event level
#' includes correction for a typo in dataframe
#' retrieves missing fishing_event_ids for sablefish surveys using major_level_ids
#'
#' @param fe df retrieved with get-event-data.sql
#'
# summarize sub/minor level counts from fishing event data at the parent event level
# includes correction for a typo in dataframe
# retrieves missing fishing_event_ids for sablefish surveys using major_level_ids
#
# @param fe df retrieved with get-event-data.sql
#
get_parent_level_counts <- function(fe) {
# just actual parent-level events
fe_A_no_parent <- filter(fe, is.na(FE_PARENT_EVENT_ID), is.na(FE_MINOR_LEVEL_ID), is.na(FE_SUB_LEVEL_ID))
Expand Down
11 changes: 5 additions & 6 deletions R/skate-level-counts.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#' summarize fishing event data at the skate level
#' retrieves missing fishing_event_ids for sablefish surveys using major_level_ids
#'
#' @param fe df retrieved with get-event-data.sql
#'

# summarize fishing event data at the skate level
# retrieves missing fishing_event_ids for sablefish surveys using major_level_ids
#
# @param fe df retrieved with get-event-data.sql
#
get_skate_level_counts <- function(fe) {
fe <- fe |> distinct()

Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: https://pbs-assess.github.io/gfdata/
template:
bootstrap: 5

18 changes: 9 additions & 9 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
citHeader("To cite gfdata in publications use:")

citEntry(
entry = "manual",
bibentry(
bibtype = "manual",
title = "{gfdata}: Data Extraction for {DFO} {PBS} Groundfish Stocks",
year = "2022",
note = "R package version 0.0.0.9000",
author = "Keppel, E. A. and Anderson, S.C. and Edwards, A. M. and Grandin, C.",
year = "2024",
note = "R package version 0.1.3",
author = "Keppel, E. A. and Anderson, S.C. and Edwards, A. M. and Grandin, C. and English, P. A.",
url = "https://github.com/pbs-assess/gfdata",
textVersion = paste(
"Keppel, E.A., S.C. Anderson, A.M. Edwards, and C. Grandin. 2022.
"Keppel, E.A., S.C. Anderson, A.M. Edwards, C. Grandin, and P.A. English. 2024.
gfdata: Data Extraction for DFO PBS Groundfish Stocks. R package version
0.0.0.9000. https://github.com/pbs-assess/gfdata"
0.1.3. https://github.com/pbs-assess/gfdata"
)
)


citEntry(
entry = "article",
bibentry(
bibtype = "article",
title = "A Reproducible Data Synopsis for over 100 Species of {British Columbia} Groundfish",
author = "Anderson, S.C. and Keppel, E. A. and Edwards, A. M.",
year = "2019",
Expand Down
17 changes: 0 additions & 17 deletions man/correct_ssids.Rd

This file was deleted.

18 changes: 0 additions & 18 deletions man/get_parent_level_counts.Rd

This file was deleted.

16 changes: 0 additions & 16 deletions man/get_skate_level_counts.Rd

This file was deleted.

1 change: 1 addition & 0 deletions man/gfdata-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions vignettes/01-gfdata-vignette.Rmd
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
title: "gfdata Vignette"
title: "Introduction to gfdata"
author: "Elise Keppel"
date: "2024-10-15"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{gfdata Vignette}
%\VignetteIndexEntry{Introduction to gfdata}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---




<style type="text/css">
body{
font-size: 11pt;
}
</style>

# Setup

Expand Down
10 changes: 7 additions & 3 deletions vignettes/02-gfdata-vignette-get-all.Rmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
---
title: "gfdata `get_all` vignette"
title: "Using 'get_all' functions"
author: "Philina English"
date: "2024-10-11"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{gfdata `get_all' Vignette}
%\VignetteIndexEntry{Using 'get_all' functions}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---


<style type="text/css">
body{
font-size: 11pt;
}
</style>

## Why use a `get_all_*()` function?

Expand Down
10 changes: 8 additions & 2 deletions vignettes/gfdata-vignette-get-all.Rmd.orig
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
---
title: "gfdata `get_all` vignette"
title: "Using 'get_all' functions"
author: "Philina English"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{gfdata `get_all' Vignette}
%\VignetteIndexEntry{Using 'get_all' functions}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

<style type="text/css">
body{
font-size: 11pt;
}
</style>

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = FALSE,
Expand Down
Loading

0 comments on commit d974d3a

Please sign in to comment.