├── .github ├── .gitignore └── workflows │ └── R-CMD-check.yaml ├── vignettes ├── .gitignore └── samplevignette.Rmd ├── R ├── import_packages.R ├── data-iris2.R ├── data-cars.R ├── sampleplot.R └── samplefunction.R ├── data ├── cars.rda └── iris2.rda ├── docs ├── logo.png ├── Scoping.pdf ├── extra.css ├── favicon.ico ├── favicon-16x16.png ├── favicon-32x32.png ├── apple-touch-icon.png ├── reference │ ├── Rplot001.png │ ├── figures │ │ └── logo.png │ ├── sampleplot-1.png │ ├── index.html │ ├── iris2.html │ ├── cars.html │ ├── samplefunction.html │ └── sampleplot.html ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon-120x120.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── articles │ ├── samplevignette_files │ │ ├── figure-html │ │ │ └── unnamed-chunk-1-1.png │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── index.html │ └── samplevignette.html ├── Page.Rmd ├── pkgdown.yml ├── link.svg ├── sitemap.xml ├── bootstrap-toc.css ├── docsearch.js ├── pkgdown.js ├── bootstrap-toc.js ├── news │ └── index.html ├── LICENSE-text.html ├── authors.html ├── 404.html ├── pkgdown.css ├── docsearch.css └── index.html ├── pkgdown ├── extra.css ├── favicon │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── apple-touch-icon.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-152x152.png │ └── apple-touch-icon-180x180.png └── _pkgdown.yml ├── man ├── figures │ └── logo.png ├── iris2.Rd ├── cars.Rd ├── sampleplot.Rd └── samplefunction.Rd ├── NAMESPACE ├── NEWS.md ├── .Rbuildignore ├── LICENSE ├── DESCRIPTION ├── .gitignore ├── README.Rmd └── README.md /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /R/import_packages.R: -------------------------------------------------------------------------------- 1 | #' @import stats 2 | #' @import graphics 3 | NULL 4 | -------------------------------------------------------------------------------- /data/cars.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/data/cars.rda -------------------------------------------------------------------------------- /data/iris2.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/data/iris2.rda -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/logo.png -------------------------------------------------------------------------------- /docs/Scoping.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/Scoping.pdf -------------------------------------------------------------------------------- /docs/extra.css: -------------------------------------------------------------------------------- 1 | @import url("https://nmfs-general-modeling-tools.github.io/nmfspalette/extra.css"); -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/favicon.ico -------------------------------------------------------------------------------- /pkgdown/extra.css: -------------------------------------------------------------------------------- 1 | @import url("https://nmfs-general-modeling-tools.github.io/nmfspalette/extra.css"); -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/favicon-32x32.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/man/figures/logo.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/sampleplot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/reference/sampleplot-1.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(samplefunction) 4 | export(sampleplot) 5 | import(graphics) 6 | import(stats) 7 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/pkgdown/favicon/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # pkgdownTemplate 2 | 3 | # Version 1.0 4 | 5 | This is a basic template with NMFS branding. It has NMFS palette and the NMFS footer, license, and **pkgdown** structure. 6 | -------------------------------------------------------------------------------- /docs/articles/samplevignette_files/figure-html/unnamed-chunk-1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/main/docs/articles/samplevignette_files/figure-html/unnamed-chunk-1-1.png -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | Readme.Rmd 4 | ^_pkgdown\.yml$ 5 | ^docs$ 6 | ^pkgdown$ 7 | ^\.github$ 8 | ^pkgdownTemplate\.Rcheck$ 9 | ^pkgdownTemplate.*\.tar\.gz$ 10 | ^pkgdownTemplate.*\.tgz$ 11 | ^DataProduct\.Rcheck$ 12 | ^DataProduct.*\.tar\.gz$ 13 | ^DataProduct.*\.tgz$ 14 | -------------------------------------------------------------------------------- /docs/Page.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Page" 3 | output: html_document 4 | --- 5 | 6 | ```{r setup, include=FALSE} 7 | knitr::opts_chunk$set(echo = TRUE) 8 | ``` 9 | 10 | ## Page 11 | 12 | You can also make a Rmd file and save the output to html. Then you can make a page of links (say) or whatever you need. -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.14.0.3 2 | pkgdown: 2.0.2 3 | pkgdown_sha: ~ 4 | articles: 5 | samplevignette: samplevignette.html 6 | last_built: 2022-02-16T03:28Z 7 | urls: 8 | reference: https://RVerse-Tutorials.github.io/DataProduct/reference 9 | article: https://RVerse-Tutorials.github.io/DataProduct/articles 10 | 11 | -------------------------------------------------------------------------------- /R/data-iris2.R: -------------------------------------------------------------------------------- 1 | #' @title sepal length for differen species of iris 2 | #' 3 | #' @description The Species and Sepal.Length from the iris data set from base R. 4 | #' 5 | #' \itemize{ 6 | #' \item Species. species 7 | #' \item Sepal.Length. sepal length 8 | #' } 9 | #' 10 | #' @docType data 11 | #' @name iris2 12 | #' @usage data(iris2) 13 | #' @references from R base package. 14 | #' @format A data frame. 15 | #' @keywords datasets 16 | NULL -------------------------------------------------------------------------------- /R/data-cars.R: -------------------------------------------------------------------------------- 1 | #' @title a dataset of horsepower for different cars 2 | #' 3 | #' @description First 4 columns of the mtcars dataset. 4 | #' 5 | #' \itemize{ 6 | #' \item mpg. miles per gallon 7 | #' \item cyl. cylinders 8 | #' \item disp. displacement 9 | #' \item hp. horse poser 10 | #' } 11 | #' 12 | #' @docType data 13 | #' @name cars 14 | #' @usage data(cars) 15 | #' @references R base package. 16 | #' @format A data frame. 17 | #' @keywords datasets 18 | NULL -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Software code created by U.S. Government employees is not subject to 2 | copyright in the United States (17 U.S.C. §105). The United State 3 | s/Department of Commerce reserve all rights to seek and obtain copyright 4 | protection in countries other than the United States for Software authored 5 | in its entirety by the Department of Commerce. To this end, the Department 6 | of Commerce hereby grants to Recipient a royalty-free, nonexclusive license 7 | to use, copy, and create derivative works of the Software outside of the 8 | United States. 9 | -------------------------------------------------------------------------------- /man/iris2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-iris2.R 3 | \docType{data} 4 | \name{iris2} 5 | \alias{iris2} 6 | \title{sepal length for differen species of iris} 7 | \format{ 8 | A data frame. 9 | } 10 | \usage{ 11 | data(iris2) 12 | } 13 | \description{ 14 | The Species and Sepal.Length from the iris data set from base R. 15 | 16 | \itemize{ 17 | \item Species. species 18 | \item Sepal.Length. sepal length 19 | } 20 | } 21 | \references{ 22 | from R base package. 23 | } 24 | \keyword{datasets} 25 | -------------------------------------------------------------------------------- /R/sampleplot.R: -------------------------------------------------------------------------------- 1 | #' Sample plot 2 | #' 3 | #' This shows how you need to use `::` with all your functions that are not in base R. 4 | #' 5 | #' @param x The x variables. 6 | #' @param y The y response values. 7 | #' @return the coefficient of the linear regression 8 | #' @examples 9 | #' x <- 1:10 10 | #' y <- 10+3*x + stats::rnorm(10, 0, 10) 11 | #' sampleplot(x, y) 12 | #' @keywords functions 13 | #' @export 14 | sampleplot <- function(x, y){ 15 | the.lm <- stats::lm(y ~ x) 16 | plot(x, y) 17 | graphics::abline(the.lm) 18 | return(coef(the.lm)) 19 | } -------------------------------------------------------------------------------- /man/cars.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data-cars.R 3 | \docType{data} 4 | \name{cars} 5 | \alias{cars} 6 | \title{a dataset of horsepower for different cars} 7 | \format{ 8 | A data frame. 9 | } 10 | \usage{ 11 | data(cars) 12 | } 13 | \description{ 14 | First 4 columns of the mtcars dataset. 15 | 16 | \itemize{ 17 | \item mpg. miles per gallon 18 | \item cyl. cylinders 19 | \item disp. displacement 20 | \item hp. horse poser 21 | } 22 | } 23 | \references{ 24 | R base package. 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /docs/articles/samplevignette_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /man/sampleplot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sampleplot.R 3 | \name{sampleplot} 4 | \alias{sampleplot} 5 | \title{Sample plot} 6 | \usage{ 7 | sampleplot(x, y) 8 | } 9 | \arguments{ 10 | \item{x}{The x variables.} 11 | 12 | \item{y}{The y response values.} 13 | } 14 | \value{ 15 | the coefficient of the linear regression 16 | } 17 | \description{ 18 | This shows how you need to use \code{::} with all your functions that are not in base R. 19 | } 20 | \examples{ 21 | x <- 1:10 22 | y <- 10+3*x + stats::rnorm(10, 0, 10) 23 | sampleplot(x, y) 24 | } 25 | \keyword{functions} 26 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: DataProduct 2 | Title: A NMFS Data Product 3 | Date: 2022-02-14 4 | Version: 1.0 5 | Authors@R: c(person("Elizabeth", "Holmes", , "eli.holmes@noaa.gov", role = c("aut", "cre")), person("Another", "Contributor", role="aut")) 6 | URL: https://rverse-tutorials.github.io/DataProduct, https://github.com/rverse-tutorials/DataProduct 7 | BugReports: https://github.com/rverse-tutorials/DataProduct/issues 8 | Description: This is an expample NMFS branded R data package with a pkgdown website. 9 | Depends: R (>= 4.0.0) 10 | Suggests: 11 | rmarkdown, 12 | knitr, 13 | tidyverse 14 | Imports: stats, graphics 15 | License: GPL-3 + file LICENSE 16 | Encoding: UTF-8 17 | LazyData: true 18 | RoxygenNote: 7.1.2 19 | Roxygen: list(markdown = TRUE) 20 | VignetteBuilder: knitr 21 | -------------------------------------------------------------------------------- /R/samplefunction.R: -------------------------------------------------------------------------------- 1 | #' Sample Function Title 2 | #' 3 | #' This part is the description. It can be as long as you want but usually is one paragraph. 4 | #' 5 | #' @param x This is a required argument and has no default value. 6 | #' @param y Has a default value of 10. 7 | #' @param z Although this looks like it is a default string, the function `match.arg()` is 8 | #' used to set it in the function. With `match.arg()`, the string specifies what values are allowed and it will throw an error if not one of those. The default is the first value. 9 | #' @return A string with the values. 10 | #' @examples 11 | #' samplefunction(1) 12 | #' @keywords functions 13 | #' @export 14 | samplefunction <- function(x, y=10, z=c("yellow", "red", "green")){ 15 | z <- match.arg(z) 16 | return(paste(x, y, z)) 17 | } 18 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | *.Rproj 8 | 9 | # User-specific files 10 | .Ruserdata 11 | 12 | # Example code in package build process 13 | *-Ex.R 14 | 15 | # Output files from R CMD build 16 | /*.tar.gz 17 | 18 | # Output files from R CMD check 19 | /*.Rcheck/ 20 | 21 | # RStudio files 22 | .Rproj.user/ 23 | 24 | # produced vignettes 25 | vignettes/*.html 26 | vignettes/*.pdf 27 | 28 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 29 | .httr-oauth 30 | 31 | # knitr and R markdown default cache directories 32 | *_cache/ 33 | /cache/ 34 | 35 | # Temporary files created by R markdown 36 | *.utf8.md 37 | *.knit.md 38 | 39 | # R Environment Variables 40 | .Renviron 41 | inst/doc 42 | pkgdownTemplate.Rcheck/ 43 | pkgdownTemplate*.tar.gz 44 | pkgdownTemplate*.tgz 45 | DataProduct.Rcheck/ 46 | DataProduct*.tar.gz 47 | DataProduct*.tgz 48 | -------------------------------------------------------------------------------- /man/samplefunction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/samplefunction.R 3 | \name{samplefunction} 4 | \alias{samplefunction} 5 | \title{Sample Function Title} 6 | \usage{ 7 | samplefunction(x, y = 10, z = c("yellow", "red", "green")) 8 | } 9 | \arguments{ 10 | \item{x}{This is a required argument and has no default value.} 11 | 12 | \item{y}{Has a default value of 10.} 13 | 14 | \item{z}{Although this looks like it is a default string, the function \code{match.arg()} is 15 | used to set it in the function. With \code{match.arg()}, the string specifies what values are allowed and it will throw an error if not one of those. The default is the first value.} 16 | } 17 | \value{ 18 | A string with the values. 19 | } 20 | \description{ 21 | This part is the description. It can be as long as you want but usually is one paragraph. 22 | } 23 | \examples{ 24 | samplefunction(1) 25 | } 26 | \keyword{functions} 27 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. 2 | # https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions 3 | # Turned of check/build of vignettes 4 | on: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | pull_request: 10 | branches: 11 | - main 12 | - master 13 | 14 | name: R-CMD-check 15 | 16 | jobs: 17 | R-CMD-check: 18 | runs-on: macOS-latest 19 | env: 20 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 21 | steps: 22 | - uses: actions/checkout@v2 23 | - uses: r-lib/actions/setup-r@v1 24 | - name: Install dependencies 25 | run: | 26 | install.packages(c("remotes", "rcmdcheck")) 27 | remotes::install_deps(dependencies = TRUE) 28 | shell: Rscript {0} 29 | - name: Check 30 | run: | 31 | options(crayon.enabled = TRUE) 32 | rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-build-vignettes"), error_on = "error", build_args = "--no-build-vignettes") 33 | shell: Rscript {0} 34 | -------------------------------------------------------------------------------- /vignettes/samplevignette.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "samplevignette" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{samplevignette} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r setup} 11 | library(DataProduct) 12 | figcap <- paste("This figure uses DataProduct version", packageVersion("DataProduct")) 13 | tabcap <- paste("This table uses DataProduct version", packageVersion("DataProduct")) 14 | ``` 15 | 16 | Here you can show uses worked up examples for your package. The easiest way to make a new package is to use `usethis::use_vignette("nameofvignette")`. 17 | 18 | ## Let's make a plot 19 | 20 | ```{r fig.align="center", fig.cap=figcap, fig.width=6} 21 | library(ggplot2) 22 | ggplot(cars, aes(x=hp, y=mpg, col=cyl)) + geom_point() 23 | ``` 24 | 25 | ## Let's make a table 26 | 27 | ```{r message=FALSE} 28 | library(knitr) 29 | library(dplyr) 30 | kable( 31 | iris2 %>% 32 | group_by(Species) %>% 33 | summarize( 34 | mean = mean(Sepal.Length), 35 | var = var(Sepal.Length), 36 | min = min(Sepal.Length), 37 | max = max(Sepal.Length)), caption=tabcap) 38 | ``` 39 | 40 | 41 | -------------------------------------------------------------------------------- /pkgdown/_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://RVerse-Tutorials.github.io/DataProduct/ 2 | 3 | navbar: 4 | structure: 5 | left: 6 | - home 7 | - reference 8 | - sourcecode 9 | - issue 10 | - articles 11 | - documents 12 | - news 13 | right: github 14 | 15 | components: 16 | home: 17 | icon: fas fa-home fa-lg 18 | href: index.html 19 | 20 | reference: 21 | text: Reference 22 | icon: far fa-file-code fa-lg 23 | href: reference/index.html 24 | 25 | sourcecode: 26 | text: Source Code 27 | icon: fab fa-github fa-lg 28 | href: https://github.com/RVerse-Tutorials/DataProduct 29 | 30 | issue: 31 | text: Issues 32 | icon: fas fa-question-circle fa-lg 33 | href: https://github.com/RVerse-Tutorials/DataProduct/issues/ 34 | 35 | articles: 36 | text: Vignettes 37 | icon: fas fa-file-contract fa-lg 38 | href: articles/index.html 39 | 40 | documents: 41 | text: Background 42 | icon: fas fa-book fa-lg 43 | menu: 44 | - text: Scoping Document 45 | href: Scoping.pdf 46 | 47 | reference: 48 | - title: Data 49 | - contents: 50 | - has_keyword("datasets") 51 | - title: Functions 52 | - contents: 53 | - has_keyword("functions") 54 | 55 | news: 56 | releases: 57 | - text: "Version 1.0" 58 | href: https://github.com/RVerse-Tutorials/DataProduct/releases/tag/v1.0 59 | 60 | authors: 61 | Elizabeth Holmes: 62 | href: https://github.com/eeholmes 63 | -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://RVerse-Tutorials.github.io/DataProduct/404.html 5 | 6 | 7 | https://RVerse-Tutorials.github.io/DataProduct/LICENSE-text.html 8 | 9 | 10 | https://RVerse-Tutorials.github.io/DataProduct/Page.html 11 | 12 | 13 | https://RVerse-Tutorials.github.io/DataProduct/articles/index.html 14 | 15 | 16 | https://RVerse-Tutorials.github.io/DataProduct/articles/samplevignette.html 17 | 18 | 19 | https://RVerse-Tutorials.github.io/DataProduct/authors.html 20 | 21 | 22 | https://RVerse-Tutorials.github.io/DataProduct/index.html 23 | 24 | 25 | https://RVerse-Tutorials.github.io/DataProduct/news/index.html 26 | 27 | 28 | https://RVerse-Tutorials.github.io/DataProduct/reference/cars.html 29 | 30 | 31 | https://RVerse-Tutorials.github.io/DataProduct/reference/index.html 32 | 33 | 34 | https://RVerse-Tutorials.github.io/DataProduct/reference/iris2.html 35 | 36 | 37 | https://RVerse-Tutorials.github.io/DataProduct/reference/samplefunction.html 38 | 39 | 40 | https://RVerse-Tutorials.github.io/DataProduct/reference/sampleplot.html 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('[data-toggle="tooltip"]').tooltip(); 13 | 14 | var cur_path = paths(location.pathname); 15 | var links = $("#navbar ul li a"); 16 | var max_length = -1; 17 | var pos = -1; 18 | for (var i = 0; i < links.length; i++) { 19 | if (links[i].getAttribute("href") === "#") 20 | continue; 21 | // Ignore external links 22 | if (links[i].host !== location.host) 23 | continue; 24 | 25 | var nav_path = paths(links[i].pathname); 26 | 27 | var length = prefix_length(nav_path, cur_path); 28 | if (length > max_length) { 29 | max_length = length; 30 | pos = i; 31 | } 32 | } 33 | 34 | // Add class to parent
  • , and enclosing
  • if in dropdown 35 | if (pos >= 0) { 36 | var menu_anchor = $(links[pos]); 37 | menu_anchor.parent().addClass("active"); 38 | menu_anchor.closest("li.dropdown").addClass("active"); 39 | } 40 | }); 41 | 42 | function paths(pathname) { 43 | var pieces = pathname.split("/"); 44 | pieces.shift(); // always starts with / 45 | 46 | var end = pieces[pieces.length - 1]; 47 | if (end === "index.html" || end === "") 48 | pieces.pop(); 49 | return(pieces); 50 | } 51 | 52 | // Returns -1 if not found 53 | function prefix_length(needle, haystack) { 54 | if (needle.length > haystack.length) 55 | return(-1); 56 | 57 | // Special case for length-0 haystack, since for loop won't run 58 | if (haystack.length === 0) { 59 | return(needle.length === 0 ? 0 : -1); 60 | } 61 | 62 | for (var i = 0; i < haystack.length; i++) { 63 | if (needle[i] != haystack[i]) 64 | return(i); 65 | } 66 | 67 | return(haystack.length); 68 | } 69 | 70 | /* Clipboard --------------------------*/ 71 | 72 | function changeTooltipMessage(element, msg) { 73 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 74 | element.setAttribute('data-original-title', msg); 75 | $(element).tooltip('show'); 76 | element.setAttribute('data-original-title', tooltipOriginalTitle); 77 | } 78 | 79 | if(ClipboardJS.isSupported()) { 80 | $(document).ready(function() { 81 | var copyButton = ""; 82 | 83 | $("div.sourceCode").addClass("hasCopyButton"); 84 | 85 | // Insert copy buttons: 86 | $(copyButton).prependTo(".hasCopyButton"); 87 | 88 | // Initialize tooltips: 89 | $('.btn-copy-ex').tooltip({container: 'body'}); 90 | 91 | // Initialize clipboard: 92 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 93 | text: function(trigger) { 94 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 95 | } 96 | }); 97 | 98 | clipboardBtnCopies.on('success', function(e) { 99 | changeTooltipMessage(e.trigger, 'Copied!'); 100 | e.clearSelection(); 101 | }); 102 | 103 | clipboardBtnCopies.on('error', function() { 104 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 105 | }); 106 | }); 107 | } 108 | })(window.jQuery || window.$) 109 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: 3 | md_document: 4 | variant: gfm 5 | --- 6 | 7 | 8 | 9 | # DataProduct 10 | 11 | 12 | [![GitHub release (latest by date)](https://img.shields.io/github/v/release/RVerse-Tutorials/DataProduct)](https://github.com/RVerse-Tutorials/DataProduct/releases) 13 | [![R-CMD-check](https://github.com/RVerse-Tutorials/DataProduct/workflows/R-CMD-check/badge.svg)](https://github.com/RVerse-Tutorials/DataProduct/actions/workflows/R-CMD-check.yaml) 14 | 15 | 16 | This is a template for a NMFS branded R package and pkgdown website. It will have a NMFS palette, appropriate license and disclaimer, and a NMFS footer with logo. 17 | 18 | The instructions will use the **usethis** and **pkgdown** packages. So install those. 19 | 20 | ## Step 1 Make sure the package builds 21 | 22 | 1. Clone this GitHub repository and then open the new repository (on your computer). 23 | 2. Set-up your RStudio project to use Roxygen for documentation and NAMESPACE 24 | * Tools > Project Options... > Build Tools Click the checkbox that says "Build documentation with Roxygen". 25 | * The Configure popup box for Roxygen will probably appear, if not click the Configure button. Check all the checkboxes. 26 | 3. On the Build tab, click Install and Restart to make sure it builds. 27 | 4. On the Build tab, click Check to make sure it passes all the checks. 28 | 5. Type the code `pkgdown::build_site()` and make sure the **pkgdown** building works. If on RStudio Cloud, you will need to use `pkgdown::build_site(override = list(destination = "~/docs"))` to see the webpage. 29 | 30 | Note steps 3 and 4 are to make sure your computer is set up to build and check packages. As long as you haven't edited the package yet, it will build and pass check. 31 | 32 | ## Step 2 Customize your package 33 | 34 | 1. Edit the DESCRIPTION file (change Title, Description, urls for repo, Authors) 35 | 2. Add any required packages to Depends (or Imports* or Suggests*). 36 | 3. Edit the Readme.Rmd file. 37 | 4. Add your functions to the R folder. There are some template functions there already. 38 | 5. Don't touch the man folder. Roxygen2 will make your Rd files. 39 | 40 | ## Step 3 Make some vignettes (optional) 41 | 42 | Vignettes are longform examples and are Rmd files in the `vignettes` folder. Easiest way to start a new vignette is `usethis::use_vignette("vignettename")`. 43 | 44 | ## Step 4 Customize your **pkgdown** site and build 45 | 46 | 1. Structure of the upper navbar. Edit `_pkgdown.yml` in the `pkddown` folder to change the look of the upper navbar. There are endless options. Find examples from other peoples' pkgdown sites. 47 | 2. Update your logo and favicons. Logo is in `man/figures`. After updating run `pkgdown::build_favicon()` to remake the favicons. 48 | 3. Add material to the `docs` folder as needed. See the example for the References tab in the `_pkgdown.yml`. 49 | 4. Build your site with `pkgdown::build_site()`. 50 | 51 | ## Step 5 Make your site live on GitHub 52 | 53 | 1. Push the changes to GitHub. 54 | 2. Click on Settings for the repository. 55 | 3. Scroll way down to the GitHub Pages section. 56 | 4. In the **Source** section, change branch to Main and folder to `docs`. There are other ways to set up GitHub Pages but this will get you started. 57 | 5. I always add my GitHub Pages URL to the repo description (on right when on your main repo page). 58 | 59 | ## NMFS Branding 60 | 61 | This template has the following branding elements. 62 | 63 | 1. `extra.css` in the `pkgdown` folder sources the **nmfspalette** css. This get you the colors. 64 | 2. The `Readme.Rmd` file sources the NMFS Disclaimer and footer with NMFS logo from the [FIT Resources](https://github.com/nmfs-fish-tools/Resources). 65 | 3. The LICENSE is set to that used by [FIT packages](https://github.com/nmfs-fish-tools). 66 | 67 | ## GitHub Actions and Badges 68 | 69 | In the `.github` folder is just one action, to run R CMD check on the package. 70 | 71 | ## Readme File 72 | 73 | **pkgdown** uses `Readme.md` but to pull in the Disclaimer and footer from FIT, you need a Rmd file. When you update the `Readme.Rmd` file, **you need to remember to knit the file** to update `Readme.md`. 74 | 75 | 76 | 77 | **** 78 | 79 | ```{r add-disclaimer, echo=FALSE, results='asis'} 80 | url <- "https://raw.githubusercontent.com/nmfs-fish-tools/Resources/master/Disclaimer.md" 81 | childtext <- readLines(url) 82 | cat(childtext, sep="\n") 83 | ``` 84 | 85 | **** 86 | 87 | ```{r footer, echo=FALSE, results='asis'} 88 | url <- "https://raw.githubusercontent.com/nmfs-fish-tools/Resources/master/footer.md" 89 | childtext <- readLines(url) 90 | cat(childtext, sep="\n") 91 | ``` 92 | 93 | 94 | -------------------------------------------------------------------------------- /docs/bootstrap-toc.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | (function() { 6 | 'use strict'; 7 | 8 | window.Toc = { 9 | helpers: { 10 | // return all matching elements in the set, or their descendants 11 | findOrFilter: function($el, selector) { 12 | // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ 13 | // http://stackoverflow.com/a/12731439/358804 14 | var $descendants = $el.find(selector); 15 | return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); 16 | }, 17 | 18 | generateUniqueIdBase: function(el) { 19 | var text = $(el).text(); 20 | var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); 21 | return anchor || el.tagName.toLowerCase(); 22 | }, 23 | 24 | generateUniqueId: function(el) { 25 | var anchorBase = this.generateUniqueIdBase(el); 26 | for (var i = 0; ; i++) { 27 | var anchor = anchorBase; 28 | if (i > 0) { 29 | // add suffix 30 | anchor += '-' + i; 31 | } 32 | // check if ID already exists 33 | if (!document.getElementById(anchor)) { 34 | return anchor; 35 | } 36 | } 37 | }, 38 | 39 | generateAnchor: function(el) { 40 | if (el.id) { 41 | return el.id; 42 | } else { 43 | var anchor = this.generateUniqueId(el); 44 | el.id = anchor; 45 | return anchor; 46 | } 47 | }, 48 | 49 | createNavList: function() { 50 | return $(''); 51 | }, 52 | 53 | createChildNavList: function($parent) { 54 | var $childList = this.createNavList(); 55 | $parent.append($childList); 56 | return $childList; 57 | }, 58 | 59 | generateNavEl: function(anchor, text) { 60 | var $a = $(''); 61 | $a.attr('href', '#' + anchor); 62 | $a.text(text); 63 | var $li = $('
  • '); 64 | $li.append($a); 65 | return $li; 66 | }, 67 | 68 | generateNavItem: function(headingEl) { 69 | var anchor = this.generateAnchor(headingEl); 70 | var $heading = $(headingEl); 71 | var text = $heading.data('toc-text') || $heading.text(); 72 | return this.generateNavEl(anchor, text); 73 | }, 74 | 75 | // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). 76 | getTopLevel: function($scope) { 77 | for (var i = 1; i <= 6; i++) { 78 | var $headings = this.findOrFilter($scope, 'h' + i); 79 | if ($headings.length > 1) { 80 | return i; 81 | } 82 | } 83 | 84 | return 1; 85 | }, 86 | 87 | // returns the elements for the top level, and the next below it 88 | getHeadings: function($scope, topLevel) { 89 | var topSelector = 'h' + topLevel; 90 | 91 | var secondaryLevel = topLevel + 1; 92 | var secondarySelector = 'h' + secondaryLevel; 93 | 94 | return this.findOrFilter($scope, topSelector + ',' + secondarySelector); 95 | }, 96 | 97 | getNavLevel: function(el) { 98 | return parseInt(el.tagName.charAt(1), 10); 99 | }, 100 | 101 | populateNav: function($topContext, topLevel, $headings) { 102 | var $context = $topContext; 103 | var $prevNav; 104 | 105 | var helpers = this; 106 | $headings.each(function(i, el) { 107 | var $newNav = helpers.generateNavItem(el); 108 | var navLevel = helpers.getNavLevel(el); 109 | 110 | // determine the proper $context 111 | if (navLevel === topLevel) { 112 | // use top level 113 | $context = $topContext; 114 | } else if ($prevNav && $context === $topContext) { 115 | // create a new level of the tree and switch to it 116 | $context = helpers.createChildNavList($prevNav); 117 | } // else use the current $context 118 | 119 | $context.append($newNav); 120 | 121 | $prevNav = $newNav; 122 | }); 123 | }, 124 | 125 | parseOps: function(arg) { 126 | var opts; 127 | if (arg.jquery) { 128 | opts = { 129 | $nav: arg 130 | }; 131 | } else { 132 | opts = arg; 133 | } 134 | opts.$scope = opts.$scope || $(document.body); 135 | return opts; 136 | } 137 | }, 138 | 139 | // accepts a jQuery object, or an options object 140 | init: function(opts) { 141 | opts = this.helpers.parseOps(opts); 142 | 143 | // ensure that the data attribute is in place for styling 144 | opts.$nav.attr('data-toggle', 'toc'); 145 | 146 | var $topContext = this.helpers.createChildNavList(opts.$nav); 147 | var topLevel = this.helpers.getTopLevel(opts.$scope); 148 | var $headings = this.helpers.getHeadings(opts.$scope, topLevel); 149 | this.helpers.populateNav($topContext, topLevel, $headings); 150 | } 151 | }; 152 | 153 | $(function() { 154 | $('nav[data-toggle="toc"]').each(function(i, el) { 155 | var $nav = $(el); 156 | Toc.init($nav); 157 | }); 158 | }); 159 | })(); 160 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # DataProduct 4 | 5 | 6 | 7 | [![GitHub release (latest by 8 | date)](https://img.shields.io/github/v/release/RVerse-Tutorials/DataProduct)](https://github.com/RVerse-Tutorials/DataProduct/releases) 9 | [![R-CMD-check](https://github.com/RVerse-Tutorials/DataProduct/workflows/R-CMD-check/badge.svg)](https://github.com/RVerse-Tutorials/DataProduct/actions/workflows/R-CMD-check.yaml) 10 | 11 | 12 | This is a template for a NMFS branded R package and pkgdown website. It 13 | will have a NMFS palette, appropriate license and disclaimer, and a NMFS 14 | footer with logo. 15 | 16 | The instructions will use the **usethis** and **pkgdown** packages. So 17 | install those. 18 | 19 | ## Step 1 Make sure the package builds 20 | 21 | 1. Clone this GitHub repository and then open the new repository (on 22 | your computer). 23 | 2. Set-up your RStudio project to use Roxygen for documentation and 24 | NAMESPACE 25 | 26 | - Tools > Project Options… > Build Tools Click the checkbox that says 27 | “Build documentation with Roxygen”. 28 | - The Configure popup box for Roxygen will probably appear, if not 29 | click the Configure button. Check all the checkboxes. 30 | 31 | 3. On the Build tab, click Install and Restart to make sure it builds. 32 | 4. On the Build tab, click Check to make sure it passes all the checks. 33 | 5. Type the code `pkgdown::build_site()` and make sure the **pkgdown** 34 | building works. If on RStudio Cloud, you will need to use 35 | `pkgdown::build_site(override = list(destination = "~/docs"))` to 36 | see the webpage. 37 | 38 | Note steps 3 and 4 are to make sure your computer is set up to build and 39 | check packages. As long as you haven’t edited the package yet, it will 40 | build and pass check. 41 | 42 | ## Step 2 Customize your package 43 | 44 | 1. Edit the DESCRIPTION file (change Title, Description, urls for repo, 45 | Authors) 46 | 2. Add any required packages to Depends (or Imports\* or Suggests\*). 47 | 3. Edit the Readme.Rmd file. 48 | 4. Add your functions to the R folder. There are some template 49 | functions there already. 50 | 5. Don’t touch the man folder. Roxygen2 will make your Rd files. 51 | 52 | ## Step 3 Make some vignettes (optional) 53 | 54 | Vignettes are longform examples and are Rmd files in the `vignettes` 55 | folder. Easiest way to start a new vignette is 56 | `usethis::use_vignette("vignettename")`. 57 | 58 | ## Step 4 Customize your **pkgdown** site and build 59 | 60 | 1. Structure of the upper navbar. Edit `_pkgdown.yml` in the `pkddown` 61 | folder to change the look of the upper navbar. There are endless 62 | options. Find examples from other peoples’ pkgdown sites. 63 | 2. Update your logo and favicons. Logo is in `man/figures`. After 64 | updating run `pkgdown::build_favicon()` to remake the favicons. 65 | 3. Add material to the `docs` folder as needed. See the example for the 66 | References tab in the `_pkgdown.yml`. 67 | 4. Build your site with `pkgdown::build_site()`. 68 | 69 | ## Step 5 Make your site live on GitHub 70 | 71 | 1. Push the changes to GitHub. 72 | 2. Click on Settings for the repository. 73 | 3. Scroll way down to the GitHub Pages section. 74 | 4. In the **Source** section, change branch to Main and folder to 75 | `docs`. There are other ways to set up GitHub Pages but this will 76 | get you started. 77 | 5. I always add my GitHub Pages URL to the repo description (on right 78 | when on your main repo page). 79 | 80 | ## NMFS Branding 81 | 82 | This template has the following branding elements. 83 | 84 | 1. `extra.css` in the `pkgdown` folder sources the **nmfspalette** css. 85 | This get you the colors. 86 | 2. The `Readme.Rmd` file sources the NMFS Disclaimer and footer with 87 | NMFS logo from the [FIT 88 | Resources](https://github.com/nmfs-fish-tools/Resources). 89 | 3. The LICENSE is set to that used by [FIT 90 | packages](https://github.com/nmfs-fish-tools). 91 | 92 | ## GitHub Actions and Badges 93 | 94 | In the `.github` folder is just one action, to run R CMD check on the 95 | package. 96 | 97 | ## Readme File 98 | 99 | **pkgdown** uses `Readme.md` but to pull in the Disclaimer and footer 100 | from FIT, you need a Rmd file. When you update the `Readme.Rmd` file, 101 | **you need to remember to knit the file** to update `Readme.md`. 102 | 103 | 104 | 105 | ------------------------------------------------------------------------ 106 | 107 | ## Disclaimer 108 | 109 | The United States Department of Commerce (DOC) GitHub project code is 110 | provided on an ‘as is’ basis and the user assumes responsibility for its 111 | use. DOC has relinquished control of the information and no longer has 112 | responsibility to protect the integrity, confidentiality, or 113 | availability of the information. Any claims against the Department of 114 | Commerce stemming from the use of its GitHub project will be governed by 115 | all applicable Federal law. Any reference to specific commercial 116 | products, processes, or services by service mark, trademark, 117 | manufacturer, or otherwise, does not constitute or imply their 118 | endorsement, recommendation or favoring by the Department of Commerce. 119 | The Department of Commerce seal and logo, or the seal and logo of a DOC 120 | bureau, shall not be used in any manner to imply endorsement of any 121 | commercial product or activity by DOC or the United States Government.” 122 | 123 | ------------------------------------------------------------------------ 124 | 125 | NOAA Fisheries 126 | 127 | [U.S. Department of Commerce](https://www.commerce.gov/) \| [National 128 | Oceanographic and Atmospheric Administration](https://www.noaa.gov) \| 129 | [NOAA Fisheries](https://www.fisheries.noaa.gov/) 130 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 103 | 104 |
    105 |

    All vignettes

    106 |

    107 | 108 |
    samplevignette
    109 |
    110 |
    111 |
    112 |
    113 | 114 | 115 |
    118 | 119 |
    120 |

    Site built with pkgdown 2.0.2.

    121 |
    122 | 123 |
    124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /docs/news/index.html: -------------------------------------------------------------------------------- 1 | 2 | Changelog • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 104 | 105 |
    106 | 107 |

    This is a basic template with NMFS branding. It has NMFS palette and the NMFS footer, license, and pkgdown structure.

    108 |
    109 |
    110 | 111 | 114 | 115 |
    116 | 117 | 118 |
    121 | 122 |
    123 |

    Site built with pkgdown 2.0.2.

    124 |
    125 | 126 |
    127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | License • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 103 | 104 |
    Software code created by U.S. Government employees is not subject to
    105 | copyright in the United States (17 U.S.C. §105). The United State
    106 | s/Department of Commerce reserve all rights to seek and obtain copyright
    107 | protection in countries other than the United States for Software authored
    108 | in its entirety by the Department of Commerce. To this end, the Department
    109 | of Commerce hereby grants to Recipient a royalty-free, nonexclusive license
    110 | to use, copy, and create derivative works of the Software outside of the
    111 | United States.
    112 | 
    113 | 114 |
    115 | 116 | 119 | 120 |
    121 | 122 | 123 | 124 |
    127 | 128 |
    129 |

    Site built with pkgdown 2.0.2.

    130 |
    131 | 132 |
    133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | Authors and Citation • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 |
    101 | 104 | 105 | 106 |
    • 107 |

      Elizabeth Holmes. Author, maintainer. 108 |

      109 |
    • 110 |
    • 111 |

      Another Contributor. Author. 112 |

      113 |
    • 114 |
    115 |
    116 |
    117 |

    Citation

    118 | Source: DESCRIPTION 119 |
    120 |
    121 | 122 | 123 |

    Holmes E, Contributor A (2022). 124 | DataProduct: A NMFS Data Product. 125 | https://rverse-tutorials.github.io/DataProduct, https://github.com/rverse-tutorials/DataProduct. 126 |

    127 |
    @Manual{,
    128 |   title = {DataProduct: A NMFS Data Product},
    129 |   author = {Elizabeth Holmes and Another Contributor},
    130 |   year = {2022},
    131 |   note = {https://rverse-tutorials.github.io/DataProduct, https://github.com/rverse-tutorials/DataProduct},
    132 | }
    133 | 134 |
    135 | 136 |
    137 | 138 | 139 | 140 |
    143 | 144 |
    145 |

    Site built with pkgdown 2.0.2.

    146 |
    147 | 148 |
    149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • DataProduct 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 |
    32 |
    129 | 130 | 131 | 132 | 133 |
    134 |
    135 | 138 | 139 | Content not found. Please use links in the navbar. 140 | 141 |
    142 | 143 | 147 | 148 |
    149 | 150 | 151 | 152 |
    156 | 157 |
    158 |

    159 |

    Site built with pkgdown 2.0.2.

    160 |
    161 | 162 |
    163 |
    164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /docs/reference/index.html: -------------------------------------------------------------------------------- 1 | 2 | Function reference • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 103 | 104 | 108 | 111 | 112 | 115 | 116 | 120 | 123 | 124 | 127 | 128 |
    105 |

    Data

    106 |

    107 |
    109 |

    cars

    110 |

    a dataset of horsepower for different cars

    113 |

    iris2

    114 |

    sepal length for differen species of iris

    117 |

    Functions

    118 |

    119 |
    121 |

    samplefunction()

    122 |

    Sample Function Title

    125 |

    sampleplot()

    126 |

    Sample plot

    129 | 130 | 133 |
    134 | 135 | 136 |
    139 | 140 |
    141 |

    Site built with pkgdown 2.0.2.

    142 |
    143 | 144 |
    145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /docs/reference/iris2.html: -------------------------------------------------------------------------------- 1 | 2 | sepal length for differen species of iris — iris2 • DataProduct 11 | 12 | 13 |
    14 |
    100 | 101 | 102 | 103 |
    104 |
    105 | 110 | 111 |
    112 |

    The Species and Sepal.Length from the iris data set from base R.

    113 |
    • Species. species

    • 114 |
    • Sepal.Length. sepal length

    • 115 |
    116 | 117 |
    118 |
    data(iris2)
    119 |
    120 | 121 |
    122 |

    Format

    123 |

    A data frame.

    124 |
    125 |
    126 |

    References

    127 |

    from R base package.

    128 |
    129 | 130 |
    131 | 134 |
    135 | 136 | 137 |
    140 | 141 |
    142 |

    Site built with pkgdown 2.0.2.

    143 |
    144 | 145 |
    146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/reference/cars.html: -------------------------------------------------------------------------------- 1 | 2 | a dataset of horsepower for different cars — cars • DataProduct 13 | 14 | 15 |
    16 |
    102 | 103 | 104 | 105 |
    106 |
    107 | 112 | 113 |
    114 |

    First 4 columns of the mtcars dataset.

    115 |
    • mpg. miles per gallon

    • 116 |
    • cyl. cylinders

    • 117 |
    • disp. displacement

    • 118 |
    • hp. horse poser

    • 119 |
    120 | 121 |
    122 |
    data(cars)
    123 |
    124 | 125 |
    126 |

    Format

    127 |

    A data frame.

    128 |
    129 |
    130 |

    References

    131 |

    R base package.

    132 |
    133 | 134 |
    135 | 138 |
    139 | 140 | 141 |
    144 | 145 |
    146 |

    Site built with pkgdown 2.0.2.

    147 |
    148 | 149 |
    150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body { 21 | position: relative; 22 | } 23 | 24 | body > .container { 25 | display: flex; 26 | height: 100%; 27 | flex-direction: column; 28 | } 29 | 30 | body > .container .row { 31 | flex: 1 0 auto; 32 | } 33 | 34 | footer { 35 | margin-top: 45px; 36 | padding: 35px 0 36px; 37 | border-top: 1px solid #e5e5e5; 38 | color: #666; 39 | display: flex; 40 | flex-shrink: 0; 41 | } 42 | footer p { 43 | margin-bottom: 0; 44 | } 45 | footer div { 46 | flex: 1; 47 | } 48 | footer .pkgdown { 49 | text-align: right; 50 | } 51 | footer p { 52 | margin-bottom: 0; 53 | } 54 | 55 | img.icon { 56 | float: right; 57 | } 58 | 59 | /* Ensure in-page images don't run outside their container */ 60 | .contents img { 61 | max-width: 100%; 62 | height: auto; 63 | } 64 | 65 | /* Fix bug in bootstrap (only seen in firefox) */ 66 | summary { 67 | display: list-item; 68 | } 69 | 70 | /* Typographic tweaking ---------------------------------*/ 71 | 72 | .contents .page-header { 73 | margin-top: calc(-60px + 1em); 74 | } 75 | 76 | dd { 77 | margin-left: 3em; 78 | } 79 | 80 | /* Section anchors ---------------------------------*/ 81 | 82 | a.anchor { 83 | display: none; 84 | margin-left: 5px; 85 | width: 20px; 86 | height: 20px; 87 | 88 | background-image: url(./link.svg); 89 | background-repeat: no-repeat; 90 | background-size: 20px 20px; 91 | background-position: center center; 92 | } 93 | 94 | h1:hover .anchor, 95 | h2:hover .anchor, 96 | h3:hover .anchor, 97 | h4:hover .anchor, 98 | h5:hover .anchor, 99 | h6:hover .anchor { 100 | display: inline-block; 101 | } 102 | 103 | /* Fixes for fixed navbar --------------------------*/ 104 | 105 | .contents h1, .contents h2, .contents h3, .contents h4 { 106 | padding-top: 60px; 107 | margin-top: -40px; 108 | } 109 | 110 | /* Navbar submenu --------------------------*/ 111 | 112 | .dropdown-submenu { 113 | position: relative; 114 | } 115 | 116 | .dropdown-submenu>.dropdown-menu { 117 | top: 0; 118 | left: 100%; 119 | margin-top: -6px; 120 | margin-left: -1px; 121 | border-radius: 0 6px 6px 6px; 122 | } 123 | 124 | .dropdown-submenu:hover>.dropdown-menu { 125 | display: block; 126 | } 127 | 128 | .dropdown-submenu>a:after { 129 | display: block; 130 | content: " "; 131 | float: right; 132 | width: 0; 133 | height: 0; 134 | border-color: transparent; 135 | border-style: solid; 136 | border-width: 5px 0 5px 5px; 137 | border-left-color: #cccccc; 138 | margin-top: 5px; 139 | margin-right: -10px; 140 | } 141 | 142 | .dropdown-submenu:hover>a:after { 143 | border-left-color: #ffffff; 144 | } 145 | 146 | .dropdown-submenu.pull-left { 147 | float: none; 148 | } 149 | 150 | .dropdown-submenu.pull-left>.dropdown-menu { 151 | left: -100%; 152 | margin-left: 10px; 153 | border-radius: 6px 0 6px 6px; 154 | } 155 | 156 | /* Sidebar --------------------------*/ 157 | 158 | #pkgdown-sidebar { 159 | margin-top: 30px; 160 | position: -webkit-sticky; 161 | position: sticky; 162 | top: 70px; 163 | } 164 | 165 | #pkgdown-sidebar h2 { 166 | font-size: 1.5em; 167 | margin-top: 1em; 168 | } 169 | 170 | #pkgdown-sidebar h2:first-child { 171 | margin-top: 0; 172 | } 173 | 174 | #pkgdown-sidebar .list-unstyled li { 175 | margin-bottom: 0.5em; 176 | } 177 | 178 | /* bootstrap-toc tweaks ------------------------------------------------------*/ 179 | 180 | /* All levels of nav */ 181 | 182 | nav[data-toggle='toc'] .nav > li > a { 183 | padding: 4px 20px 4px 6px; 184 | font-size: 1.5rem; 185 | font-weight: 400; 186 | color: inherit; 187 | } 188 | 189 | nav[data-toggle='toc'] .nav > li > a:hover, 190 | nav[data-toggle='toc'] .nav > li > a:focus { 191 | padding-left: 5px; 192 | color: inherit; 193 | border-left: 1px solid #878787; 194 | } 195 | 196 | nav[data-toggle='toc'] .nav > .active > a, 197 | nav[data-toggle='toc'] .nav > .active:hover > a, 198 | nav[data-toggle='toc'] .nav > .active:focus > a { 199 | padding-left: 5px; 200 | font-size: 1.5rem; 201 | font-weight: 400; 202 | color: inherit; 203 | border-left: 2px solid #878787; 204 | } 205 | 206 | /* Nav: second level (shown on .active) */ 207 | 208 | nav[data-toggle='toc'] .nav .nav { 209 | display: none; /* Hide by default, but at >768px, show it */ 210 | padding-bottom: 10px; 211 | } 212 | 213 | nav[data-toggle='toc'] .nav .nav > li > a { 214 | padding-left: 16px; 215 | font-size: 1.35rem; 216 | } 217 | 218 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 219 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 220 | padding-left: 15px; 221 | } 222 | 223 | nav[data-toggle='toc'] .nav .nav > .active > a, 224 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 225 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 226 | padding-left: 15px; 227 | font-weight: 500; 228 | font-size: 1.35rem; 229 | } 230 | 231 | /* orcid ------------------------------------------------------------------- */ 232 | 233 | .orcid { 234 | font-size: 16px; 235 | color: #A6CE39; 236 | /* margins are required by official ORCID trademark and display guidelines */ 237 | margin-left:4px; 238 | margin-right:4px; 239 | vertical-align: middle; 240 | } 241 | 242 | /* Reference index & topics ----------------------------------------------- */ 243 | 244 | .ref-index th {font-weight: normal;} 245 | 246 | .ref-index td {vertical-align: top; min-width: 100px} 247 | .ref-index .icon {width: 40px;} 248 | .ref-index .alias {width: 40%;} 249 | .ref-index-icons .alias {width: calc(40% - 40px);} 250 | .ref-index .title {width: 60%;} 251 | 252 | .ref-arguments th {text-align: right; padding-right: 10px;} 253 | .ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} 254 | .ref-arguments .name {width: 20%;} 255 | .ref-arguments .desc {width: 80%;} 256 | 257 | /* Nice scrolling for wide elements --------------------------------------- */ 258 | 259 | table { 260 | display: block; 261 | overflow: auto; 262 | } 263 | 264 | /* Syntax highlighting ---------------------------------------------------- */ 265 | 266 | pre, code, pre code { 267 | background-color: #f8f8f8; 268 | color: #333; 269 | } 270 | pre, pre code { 271 | white-space: pre-wrap; 272 | word-break: break-all; 273 | overflow-wrap: break-word; 274 | } 275 | 276 | pre { 277 | border: 1px solid #eee; 278 | } 279 | 280 | pre .img, pre .r-plt { 281 | margin: 5px 0; 282 | } 283 | 284 | pre .img img, pre .r-plt img { 285 | background-color: #fff; 286 | } 287 | 288 | code a, pre a { 289 | color: #375f84; 290 | } 291 | 292 | a.sourceLine:hover { 293 | text-decoration: none; 294 | } 295 | 296 | .fl {color: #1514b5;} 297 | .fu {color: #000000;} /* function */ 298 | .ch,.st {color: #036a07;} /* string */ 299 | .kw {color: #264D66;} /* keyword */ 300 | .co {color: #888888;} /* comment */ 301 | 302 | .error {font-weight: bolder;} 303 | .warning {font-weight: bolder;} 304 | 305 | /* Clipboard --------------------------*/ 306 | 307 | .hasCopyButton { 308 | position: relative; 309 | } 310 | 311 | .btn-copy-ex { 312 | position: absolute; 313 | right: 0; 314 | top: 0; 315 | visibility: hidden; 316 | } 317 | 318 | .hasCopyButton:hover button.btn-copy-ex { 319 | visibility: visible; 320 | } 321 | 322 | /* headroom.js ------------------------ */ 323 | 324 | .headroom { 325 | will-change: transform; 326 | transition: transform 200ms linear; 327 | } 328 | .headroom--pinned { 329 | transform: translateY(0%); 330 | } 331 | .headroom--unpinned { 332 | transform: translateY(-100%); 333 | } 334 | 335 | /* mark.js ----------------------------*/ 336 | 337 | mark { 338 | background-color: rgba(255, 255, 51, 0.5); 339 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 340 | padding: 1px; 341 | } 342 | 343 | /* vertical spacing after htmlwidgets */ 344 | .html-widget { 345 | margin-bottom: 10px; 346 | } 347 | 348 | /* fontawesome ------------------------ */ 349 | 350 | .fab { 351 | font-family: "Font Awesome 5 Brands" !important; 352 | } 353 | 354 | /* don't display links in code chunks when printing */ 355 | /* source: https://stackoverflow.com/a/10781533 */ 356 | @media print { 357 | code a:link:after, code a:visited:after { 358 | content: ""; 359 | } 360 | } 361 | 362 | /* Section anchors --------------------------------- 363 | Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 364 | */ 365 | 366 | div.csl-bib-body { } 367 | div.csl-entry { 368 | clear: both; 369 | } 370 | .hanging-indent div.csl-entry { 371 | margin-left:2em; 372 | text-indent:-2em; 373 | } 374 | div.csl-left-margin { 375 | min-width:2em; 376 | float:left; 377 | } 378 | div.csl-right-inline { 379 | margin-left:2em; 380 | padding-left:1em; 381 | } 382 | div.csl-indent { 383 | margin-left: 2em; 384 | } 385 | -------------------------------------------------------------------------------- /docs/reference/samplefunction.html: -------------------------------------------------------------------------------- 1 | 2 | Sample Function Title — samplefunction • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 105 | 106 |
    107 |

    This part is the description. It can be as long as you want but usually is one paragraph.

    108 |
    109 | 110 |
    111 |
    samplefunction(x, y = 10, z = c("yellow", "red", "green"))
    112 |
    113 | 114 |
    115 |

    Arguments

    116 |
    x
    117 |

    This is a required argument and has no default value.

    118 |
    y
    119 |

    Has a default value of 10.

    120 |
    z
    121 |

    Although this looks like it is a default string, the function match.arg() is 122 | used to set it in the function. With match.arg(), the string specifies what values are allowed and it will throw an error if not one of those. The default is the first value.

    123 |
    124 |
    125 |

    Value

    126 |

    A string with the values.

    127 |
    128 | 129 |
    130 |

    Examples

    131 |
    samplefunction(1)
    132 | #> [1] "1 10 yellow"
    133 | 
    134 |
    135 |
    136 | 139 |
    140 | 141 | 142 |
    145 | 146 |
    147 |

    Site built with pkgdown 2.0.2.

    148 |
    149 | 150 |
    151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /docs/reference/sampleplot.html: -------------------------------------------------------------------------------- 1 | 2 | Sample plot — sampleplot • DataProduct 6 | 7 | 8 |
    9 |
    95 | 96 | 97 | 98 |
    99 |
    100 | 105 | 106 |
    107 |

    This shows how you need to use :: with all your functions that are not in base R.

    108 |
    109 | 110 |
    111 |
    sampleplot(x, y)
    112 |
    113 | 114 |
    115 |

    Arguments

    116 |
    x
    117 |

    The x variables.

    118 |
    y
    119 |

    The y response values.

    120 |
    121 |
    122 |

    Value

    123 |

    the coefficient of the linear regression

    124 |
    125 | 126 |
    127 |

    Examples

    128 |
    x <- 1:10
    129 | y <- 10+3*x + stats::rnorm(10, 0, 10)
    130 | sampleplot(x, y)
    131 | 
    132 | #> (Intercept)           x 
    133 | #>   12.969998    2.556096 
    134 | 
    135 |
    136 |
    137 | 140 |
    141 | 142 | 143 |
    146 | 147 |
    148 |

    Site built with pkgdown 2.0.2.

    149 |
    150 | 151 |
    152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /docs/docsearch.css: -------------------------------------------------------------------------------- 1 | /* Docsearch -------------------------------------------------------------- */ 2 | /* 3 | Source: https://github.com/algolia/docsearch/ 4 | License: MIT 5 | */ 6 | 7 | .algolia-autocomplete { 8 | display: block; 9 | -webkit-box-flex: 1; 10 | -ms-flex: 1; 11 | flex: 1 12 | } 13 | 14 | .algolia-autocomplete .ds-dropdown-menu { 15 | width: 100%; 16 | min-width: none; 17 | max-width: none; 18 | padding: .75rem 0; 19 | background-color: #fff; 20 | background-clip: padding-box; 21 | border: 1px solid rgba(0, 0, 0, .1); 22 | box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); 23 | } 24 | 25 | @media (min-width:768px) { 26 | .algolia-autocomplete .ds-dropdown-menu { 27 | width: 175% 28 | } 29 | } 30 | 31 | .algolia-autocomplete .ds-dropdown-menu::before { 32 | display: none 33 | } 34 | 35 | .algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { 36 | padding: 0; 37 | background-color: rgb(255,255,255); 38 | border: 0; 39 | max-height: 80vh; 40 | } 41 | 42 | .algolia-autocomplete .ds-dropdown-menu .ds-suggestions { 43 | margin-top: 0 44 | } 45 | 46 | .algolia-autocomplete .algolia-docsearch-suggestion { 47 | padding: 0; 48 | overflow: visible 49 | } 50 | 51 | .algolia-autocomplete .algolia-docsearch-suggestion--category-header { 52 | padding: .125rem 1rem; 53 | margin-top: 0; 54 | font-size: 1.3em; 55 | font-weight: 500; 56 | color: #00008B; 57 | border-bottom: 0 58 | } 59 | 60 | .algolia-autocomplete .algolia-docsearch-suggestion--wrapper { 61 | float: none; 62 | padding-top: 0 63 | } 64 | 65 | .algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { 66 | float: none; 67 | width: auto; 68 | padding: 0; 69 | text-align: left 70 | } 71 | 72 | .algolia-autocomplete .algolia-docsearch-suggestion--content { 73 | float: none; 74 | width: auto; 75 | padding: 0 76 | } 77 | 78 | .algolia-autocomplete .algolia-docsearch-suggestion--content::before { 79 | display: none 80 | } 81 | 82 | .algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { 83 | padding-top: .75rem; 84 | margin-top: .75rem; 85 | border-top: 1px solid rgba(0, 0, 0, .1) 86 | } 87 | 88 | .algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { 89 | display: block; 90 | padding: .1rem 1rem; 91 | margin-bottom: 0.1; 92 | font-size: 1.0em; 93 | font-weight: 400 94 | /* display: none */ 95 | } 96 | 97 | .algolia-autocomplete .algolia-docsearch-suggestion--title { 98 | display: block; 99 | padding: .25rem 1rem; 100 | margin-bottom: 0; 101 | font-size: 0.9em; 102 | font-weight: 400 103 | } 104 | 105 | .algolia-autocomplete .algolia-docsearch-suggestion--text { 106 | padding: 0 1rem .5rem; 107 | margin-top: -.25rem; 108 | font-size: 0.8em; 109 | font-weight: 400; 110 | line-height: 1.25 111 | } 112 | 113 | .algolia-autocomplete .algolia-docsearch-footer { 114 | width: 110px; 115 | height: 20px; 116 | z-index: 3; 117 | margin-top: 10.66667px; 118 | float: right; 119 | font-size: 0; 120 | line-height: 0; 121 | } 122 | 123 | .algolia-autocomplete .algolia-docsearch-footer--logo { 124 | background-image: url("data:image/svg+xml;utf8,"); 125 | background-repeat: no-repeat; 126 | background-position: 50%; 127 | background-size: 100%; 128 | overflow: hidden; 129 | text-indent: -9000px; 130 | width: 100%; 131 | height: 100%; 132 | display: block; 133 | transform: translate(-8px); 134 | } 135 | 136 | .algolia-autocomplete .algolia-docsearch-suggestion--highlight { 137 | color: #FF8C00; 138 | background: rgba(232, 189, 54, 0.1) 139 | } 140 | 141 | 142 | .algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { 143 | box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) 144 | } 145 | 146 | .algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { 147 | background-color: rgba(192, 192, 192, .15) 148 | } 149 | -------------------------------------------------------------------------------- /docs/articles/samplevignette.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | samplevignette • DataProduct 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 |
    33 |
    130 | 131 | 132 | 133 | 134 |
    135 |
    136 | 144 | 145 | 146 | 147 | 149 |
    ## 
    150 | ## Attaching package: 'DataProduct'
    151 |
    ## The following object is masked from 'package:datasets':
    152 | ## 
    153 | ##     cars
    154 |
    155 | figcap <- paste("This figure uses DataProduct version", packageVersion("DataProduct"))
    156 | tabcap <- paste("This table uses DataProduct version", packageVersion("DataProduct"))
    157 |

    Here you can show uses worked up examples for your package. The easiest way to make a new package is to use usethis::use_vignette("nameofvignette").

    158 |
    159 |

    Let’s make a plot 160 |

    161 |
    162 | library(ggplot2)
    163 | ggplot(cars, aes(x=hp, y=mpg, col=cyl)) + geom_point()
    164 |
    165 | This figure uses DataProduct version 1.0

    166 | This figure uses DataProduct version 1.0 167 |

    168 |
    169 |
    170 |
    171 |

    Let’s make a table 172 |

    173 |
    174 | library(knitr)
    175 | library(dplyr)
    176 | kable(
    177 |   iris2 %>% 
    178 |     group_by(Species) %>% 
    179 |     summarize(
    180 |       mean = mean(Sepal.Length), 
    181 |       var = var(Sepal.Length),
    182 |       min = min(Sepal.Length),
    183 |       max = max(Sepal.Length)), caption=tabcap)
    184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 |
    This table uses DataProduct version 1.0
    Speciesmeanvarminmax
    setosa5.0060.12424904.35.8
    versicolor5.9360.26643274.97.0
    virginica6.5880.40434294.97.9
    217 |
    218 |
    219 | 220 | 225 | 226 |
    227 | 228 | 229 | 230 |
    234 | 235 |
    236 |

    237 |

    Site built with pkgdown 2.0.2.

    238 |
    239 | 240 |
    241 |
    242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | A NMFS Data Product • DataProduct 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 |
    33 |
    130 | 131 | 132 | 133 | 134 |
    135 |
    136 |
    137 | 139 | 140 | 141 |

    This is a template for a NMFS branded R package and pkgdown website. It will have a NMFS palette, appropriate license and disclaimer, and a NMFS footer with logo.

    142 |

    The instructions will use the usethis and pkgdown packages. So install those.

    143 |
    144 |

    Step 1 Make sure the package builds 145 |

    146 |
      147 |
    1. Clone this GitHub repository and then open the new repository (on your computer).
    2. 148 |
    3. Set-up your RStudio project to use Roxygen for documentation and NAMESPACE
    4. 149 |
    150 |
      151 |
    • Tools > Project Options… > Build Tools Click the checkbox that says “Build documentation with Roxygen”.
    • 152 |
    • The Configure popup box for Roxygen will probably appear, if not click the Configure button. Check all the checkboxes.
    • 153 |
    154 |
      155 |
    1. On the Build tab, click Install and Restart to make sure it builds.
    2. 156 |
    3. On the Build tab, click Check to make sure it passes all the checks.
    4. 157 |
    5. Type the code pkgdown::build_site() and make sure the pkgdown building works. If on RStudio Cloud, you will need to use pkgdown::build_site(override = list(destination = "~/docs")) to see the webpage.
    6. 158 |
    159 |

    Note steps 3 and 4 are to make sure your computer is set up to build and check packages. As long as you haven’t edited the package yet, it will build and pass check.

    160 |
    161 |
    162 |

    Step 2 Customize your package 163 |

    164 |
      165 |
    1. Edit the DESCRIPTION file (change Title, Description, urls for repo, Authors)
    2. 166 |
    3. Add any required packages to Depends (or Imports* or Suggests*).
    4. 167 |
    5. Edit the Readme.Rmd file.
    6. 168 |
    7. Add your functions to the R folder. There are some template functions there already.
    8. 169 |
    9. Don’t touch the man folder. Roxygen2 will make your Rd files.
    10. 170 |
    171 |
    172 |
    173 |

    Step 3 Make some vignettes (optional) 174 |

    175 |

    Vignettes are longform examples and are Rmd files in the vignettes folder. Easiest way to start a new vignette is usethis::use_vignette("vignettename").

    176 |
    177 |
    178 |

    Step 4 Customize your pkgdown site and build 179 |

    180 |
      181 |
    1. Structure of the upper navbar. Edit _pkgdown.yml in the pkddown folder to change the look of the upper navbar. There are endless options. Find examples from other peoples’ pkgdown sites.
    2. 182 |
    3. Update your logo and favicons. Logo is in man/figures. After updating run pkgdown::build_favicon() to remake the favicons.
    4. 183 |
    5. Add material to the docs folder as needed. See the example for the References tab in the _pkgdown.yml.
    6. 184 |
    7. Build your site with pkgdown::build_site().
    8. 185 |
    186 |
    187 |
    188 |

    Step 5 Make your site live on GitHub 189 |

    190 |
      191 |
    1. Push the changes to GitHub.
    2. 192 |
    3. Click on Settings for the repository.
    4. 193 |
    5. Scroll way down to the GitHub Pages section.
    6. 194 |
    7. In the Source section, change branch to Main and folder to docs. There are other ways to set up GitHub Pages but this will get you started.
    8. 195 |
    9. I always add my GitHub Pages URL to the repo description (on right when on your main repo page).
    10. 196 |
    197 |
    198 |
    199 |

    NMFS Branding 200 |

    201 |

    This template has the following branding elements.

    202 |
      203 |
    1. 204 | extra.css in the pkgdown folder sources the nmfspalette css. This get you the colors.
    2. 205 |
    3. The Readme.Rmd file sources the NMFS Disclaimer and footer with NMFS logo from the FIT Resources.
    4. 206 |
    5. The LICENSE is set to that used by FIT packages.
    6. 207 |
    208 |
    209 |
    210 |

    GitHub Actions and Badges 211 |

    212 |

    In the .github folder is just one action, to run R CMD check on the package.

    213 |
    214 |
    215 |

    Readme File 216 |

    217 |

    pkgdown uses Readme.md but to pull in the Disclaimer and footer from FIT, you need a Rmd file. When you update the Readme.Rmd file, you need to remember to knit the file to update Readme.md.

    218 | 219 |
    220 |
    221 |
    222 |

    Disclaimer 223 |

    224 |

    The United States Department of Commerce (DOC) GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. DOC has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any claims against the Department of Commerce stemming from the use of its 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.”

    225 |
    226 |

    NOAA Fisheries

    227 |

    U.S. Department of Commerce | National Oceanographic and Atmospheric Administration | NOAA Fisheries

    228 |
    229 |
    230 |
    231 | 232 | 276 |
    277 | 278 | 279 | 290 |
    291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | --------------------------------------------------------------------------------