Skip to content

Commit

Permalink
Merge pull request #58 from NOAA-EDAB/andy_ghpages
Browse files Browse the repository at this point in the history
deploy pkgdown to ghpages
  • Loading branch information
BBeltz1 authored Aug 11, 2023
2 parents c8aa458 + b8fa3ce commit efecb5b
Show file tree
Hide file tree
Showing 674 changed files with 807 additions and 83,158 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: gh-pages

on:
push:
branches:
- main
- master


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

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

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

- 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@v2
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 binary dependencies
if: runner.os != 'Linux'
run: |
remotes::install_deps(dependencies = TRUE, type="binary")
shell: Rscript {0}

- name: Install pkgdown
run: |
install.packages("pkgdown", type = "binary")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ inst/doc
.RData
.Ruserdata
.DS_Store

# folders
docs
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Package: ecodata
Title: Documentation of Ecosystem Indicator Reporting
Version: 0.1.0
Authors@R: c(person("Kimberly", "Bastille", email = "[email protected]", role = c("cre", "aut")),
Authors@R: c(person("Brandon", "Beltz", email = "[email protected]", role = c("cre", "aut")),
person("Kimberly", "Bastille", email = "[email protected]", role = "aut"),
person("Sean", "Hardison", role = "aut"))
Description: A data package for reporting on Northeast Continental Shelf ecosystem status and trends.
License: file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Date: 2018-10-24
Suggests:
Suggests:
knitr,
rmarkdown,
dplyr,
Expand All @@ -22,8 +23,9 @@ Suggests:
usethis,
AICcmodavg,
mgcv,
zoo
zoo,
rlang
VignetteBuilder: knitr
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
Depends:
R (>= 2.10)
2 changes: 1 addition & 1 deletion R/ch_bay_sf.R → R/ches_bay_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#' }
#'
#' @details More information available at \url{https://noaa-edab.github.io/tech-doc/https://noaa-edab.github.io/tech-doc/chesapeake-bay-salinity-and-temperature.html}
"ch_bay_sf"
"ches_bay_sf"
17 changes: 17 additions & 0 deletions R/hp_density.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' hp_density
#'
#' What is it?
#'
#' @format A data set containing 6244 rows and 5 columns.
#'
#' \itemize{
#' \item {Latitude}{Latitude}
#' \item {Longitude}{Longitude}
#' \item {Value}{Value}
#' \item {Bin}{??}
#' \item {Season}{???}
#'
#' }
#'
#' @details More information available at \url{link to techdoc}
"hp_density"
19 changes: 19 additions & 0 deletions R/long_line_survey.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#' longline survey
#'
#' What is it?
#'
#' @format A data set containing 96 rows and 8 columns.
#'
#' \itemize{
#' \item {Cruise}{Latitude}
#' \item {Station}{Longitude}
#' \item {Year}{Value}
#' \item {Common_name}{??}
#' \item {Deceg_beglat_set}{???}
#' \item {Deceg_beglon_set}{???}
#' \item {categ}{???}
#'
#' }
#'
#' @details More information available at \url{link to techdoc}
"long_line_survey"
13 changes: 13 additions & 0 deletions R/longlinesurvey_sf.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#' Longline survey sf index ?????
#'
#'
#'
#' @format Simple feature collection with 6 features and 7 fields
#'
#' \itemize{
#' \item geometry: yearly spatial feature for the longline survey.
#'
#' }
#'
#' @details More information available at \url{??}
"longlinesurvey_sf"
17 changes: 17 additions & 0 deletions R/lps_sharks.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' lps_sharks ???
#'
#' What is it?
#'
#' @format A data set containing 90 rows and 5 columns.
#'
#' \itemize{
#' \item {Time}{???}
#' \item {Var}{???}
#' \item {Value}{???}
#' \item {EPU}{??}
#' \item {Units}{???}
#'
#' }
#'
#' @details More information available at \url{link to techdoc}
"lps_sharks"
108 changes: 18 additions & 90 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ knitr::opts_chunk$set(
out.width = "100%"
)
```
# ecodata <img src="https://github.com/NOAA-EDAB/ecodata/blob/master/ecodata_logo.png" align="right" width="120" />
# ecodata <img src="man/figures/ecodata_logo.png" align="right" width="120" />

<!-- badges: start -->
![gitleaks](https://github.com/NOAA-EDAB/ecodata/workflows/gitleaks/badge.svg)
[![gitleaks](https://github.com/NOAA-EDAB/ecodata/actions/workflows/secretScan.yml/badge.svg)](https://github.com/NOAA-EDAB/ecodata/actions/workflows/secretScan.yml)
<!-- badges: end -->

## Overview
Expand All @@ -30,108 +30,36 @@ Management Councils (FMCs), and therefore indicator data for Scotian Shelf are i

### Please consult the [technical documentation](https://noaa-edab.github.io/tech-doc/) of SOE indicators before using data sets.

## Using this package
## State of the Ecosystem cycle

1. Use the command `remotes::install_github("noaa-edab/ecodata",build_vignettes=TRUE)` to install the package.
2. Load the package into your environment with `library(ecodata)`
3. Further information about the `ecodata` package can be found [here](https://noaa-edab.github.io/ecodata/).
The main branch of this repository contains the data used in the most recently published [State of the Ecosystem](https://www.fisheries.noaa.gov/new-england-mid-atlantic/ecosystems/state-ecosystem-reports-northeast-us-shelf) reports (Mid Atlantic and New England reports). Data for use in the following years report can be found on the `dev` branch of the repository. Once the reports are written and the cycle ends this data will be pulled into the main branch and [released](https://github.com/NOAA-EDAB/ecodata/releases)

## Loading data sets

1. All derived data sets are available once the package has been loaded into the environment. View available data sets using the syntax `ecodata::...`

<p align="center" width="645">
<img src="https://raw.githubusercontent.com/NOAA-EDAB/ecodata/master/ecodata1.gif">
</p>
## Installation

## Using geom_gls()

Also included in this package is a "geom" extension of `ggplot2` for assessing trends in time series. This function fits four trend models to each
series, uses AICc to select the best model fit, and then implements a likelihood-ratio test to determine if a trend is present. If a significant
trend is present (*P* < 0.05), then the trend line is plotted with the series. By default, a purple line color is assigned to negative trends and orange to positive trends. More detailed information about this method is available
[here](https://noaa-edab.github.io/tech-doc/trend-analysis.html).

`geom_gls()` follows the same rules as other `ggplot` stats/geoms. For example,
For the last released complete data set

```{r, eval = F}
remotes::install_github("noaa-edab/ecodata",build_vignettes=TRUE)
```
m <- 0.1
x <- 1:30
y <- m*x + rnorm(30, sd = 0.35)

data <- data.frame(x = x,
y = y)
For data used in the current developing cycle

#Plot series with trend
ggplot2::ggplot(data = data,aes(x = x, y = y)) +
geom_line() +
geom_gls()
```{r, eval = F}
remotes::install_github("noaa-edab/ecodata@dev",build_vignettes=TRUE)
```

produces

```{r neusfig, echo=F}
knitr::include_graphics(path="https://raw.githubusercontent.com/NOAA-EDAB/ecodata/master/docs/images/geom_gls.png")
```

This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.


## Build documentation

Organize [Reference](https://noaa-edab.github.io/ecodata/reference/index.html) by datasets and functions in `inst/_pkgdown.yml` and update using:

```{r, eval=F}
update_datasets_reference <- function(){
library(here)
library(dplyr)
library(yaml)
yml <- here("inst/_pkgdown.yml")
lst <- read_yaml(yml)
# listviewer::jsonedit(lst)
# inject reference to datasets
datasets <- data(package="ecodata") %>% .$results %>% .[, "Item"]
lst$reference <- list(
title = "Datasets",
contents = datasets)
write_yaml(lst, yml)
}
# build just Reference index
pkgdown::build_reference_index()
## Loading data sets

# build whole documentation website into docs/*
pkgdown::build_site()
```
1. All derived data sets are available once the package has been loaded into the environment. View available data sets using the syntax `ecodata::...`

Note that when building, you'll get alerted if datasets are missing or not included, eg:
<p align="center" width="645">
<img src="https://raw.githubusercontent.com/NOAA-EDAB/ecodata/master/ecodata1.gif">
</p>

```
> pkgdown::build_reference_index()
Writing 'reference/index.html'
Warning messages:
1: In '_pkgdown.yml', topic must be a known topic name or alias
x Not '`heatwave_year`'
2: In '_pkgdown.yml', topic must be a known topic name or alias
x Not '`seasonal_sst_anom_gridded`'
3: In '_pkgdown.yml', topic must be a known topic name or alias
x Not '`wind`'
4: Topics missing from index:
* ecodata
* seasonal_sst_anomaly_gridded
* soe
```

### Legal disclaimer

Aside: get all plot chunks mentioning given dataset for Uploader:
*This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.*

```{r, eval=F}
dataset <- "chl_pp"
res <- system(glue::glue("grep ecodata::{dataset} chunk-scripts/*", intern = T))
# todo: get just filenames
res
```

Loading

0 comments on commit efecb5b

Please sign in to comment.