├── .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/HEAD/data/cars.rda
--------------------------------------------------------------------------------
/data/iris2.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/data/iris2.rda
--------------------------------------------------------------------------------
/docs/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/logo.png
--------------------------------------------------------------------------------
/docs/Scoping.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/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/HEAD/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/HEAD/docs/favicon-16x16.png
--------------------------------------------------------------------------------
/docs/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/favicon-32x32.png
--------------------------------------------------------------------------------
/man/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/man/figures/logo.png
--------------------------------------------------------------------------------
/docs/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon.png
--------------------------------------------------------------------------------
/docs/reference/Rplot001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/reference/Rplot001.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/docs/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/docs/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/docs/reference/figures/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/reference/figures/logo.png
--------------------------------------------------------------------------------
/docs/reference/sampleplot-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/reference/sampleplot-1.png
--------------------------------------------------------------------------------
/docs/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/docs/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/docs/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/docs/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/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/HEAD/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/pkgdown/favicon/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RVerse-Tutorials/DataProduct/HEAD/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/HEAD/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 |
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 |
10 |
11 |
12 | [](https://github.com/RVerse-Tutorials/DataProduct/releases)
13 | [](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 = $('
4 |
5 |
6 |
7 | [](https://github.com/RVerse-Tutorials/DataProduct/releases)
9 | [](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 |
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 | NEWS.md
103 | 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 |
105 | Data106 | 107 | |
108 | |
|---|---|
| 109 | 110 | | 111 |a dataset of horsepower for different cars |
112 |
| 113 | 114 | | 115 |sepal length for differen species of iris |
116 |
117 | Functions118 | 119 | |
120 | |
| 121 | 122 | | 123 |Sample Function Title |
124 |
| 125 | 126 | | 127 |Sample plot |
128 |
The Species and Sepal.Length from the iris data set from base R.
113 |Species. species
Sepal.Length. sepal length
data(iris2)A data frame.
124 |from R base package.
128 |First 4 columns of the mtcars dataset.
115 |mpg. miles per gallon
cyl. cylinders
disp. displacement
hp. horse poser
data(cars)A data frame.
128 |R base package.
132 |This part is the description. It can be as long as you want but usually is one paragraph.
108 |samplefunction(x, y = 10, z = c("yellow", "red", "green"))This is a required argument and has no default value.
Has a default value of 10.
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.
A string with the values.
127 |samplefunction(1)
132 | #> [1] "1 10 yellow"
133 | This shows how you need to use :: with all your functions that are not in base R.
sampleplot(x, y)The x variables.
The y response values.
the coefficient of the linear regression
124 |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 | vignettes/samplevignette.Rmd
141 | samplevignette.Rmd
148 | library(DataProduct)##
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"))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").
162 | library(ggplot2)
163 | ggplot(cars, aes(x=hp, y=mpg, col=cyl)) + geom_point()
166 | This figure uses DataProduct version 1.0 167 |
168 |
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)| Species | 188 |mean | 189 |var | 190 |min | 191 |max | 192 |
|---|---|---|---|---|
| setosa | 196 |5.006 | 197 |0.1242490 | 198 |4.3 | 199 |5.8 | 200 |
| versicolor | 203 |5.936 | 204 |0.2664327 | 205 |4.9 | 206 |7.0 | 207 |
| virginica | 210 |6.588 | 211 |0.4043429 | 212 |4.9 | 213 |7.9 | 214 |
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 |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.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 |Vignettes are longform examples and are Rmd files in the vignettes folder. Easiest way to start a new vignette is usethis::use_vignette("vignettename").
_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.man/figures. After updating run pkgdown::build_favicon() to remake the favicons.docs folder as needed. See the example for the References tab in the _pkgdown.yml.pkgdown::build_site().docs. There are other ways to set up GitHub Pages but this will get you started.This template has the following branding elements.
202 |extra.css in the pkgdown folder sources the nmfspalette css. This get you the colors.Readme.Rmd file sources the NMFS Disclaimer and footer with NMFS logo from the FIT Resources.In the .github folder is just one action, to run R CMD check on the package.
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.
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 |
U.S. Department of Commerce | National Oceanographic and Atmospheric Administration | NOAA Fisheries
228 |