Skip to content

Commit

Permalink
package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mdancho84 committed Mar 20, 2021
1 parent 7405760 commit 599694f
Show file tree
Hide file tree
Showing 21 changed files with 305 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^LICENSE\.md$
^README\.Rmd$
^.*\.Rproj$
^\.Rproj\.user$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.Rhistory
.RData
.Ruserdata
inst/doc
28 changes: 28 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Package: gamsnip
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person(given = "First",
family = "Last",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
parsnip,
rlang (>= 0.1.2),
magrittr
Suggests:
tidymodels,
modeltime,
knitr,
rmarkdown,
roxygen2,
testthat (>= 3.0.0)
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
VignetteBuilder: knitr
Config/testthat/edition: 3
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2021
COPYRIGHT HOLDER: BUSINESS SCIENCE
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2021 BUSINESS SCIENCE

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(":=")
export(.data)
export(as_label)
export(as_name)
export(enquo)
export(enquos)
export(expr)
export(sym)
export(syms)
importFrom(magrittr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(rlang,expr)
importFrom(rlang,sym)
importFrom(rlang,syms)
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# gamsnip 0.0.0.9000

* Added a `NEWS.md` file to track changes to the package.
6 changes: 6 additions & 0 deletions R/parsnip-linear_gam.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# linear_gam() - General Interface to Linear GAM Models
# - backend: mgcv
# - prediction: classification, type = class, type = prob.
# See ?predict.model_fit

# We can add more backends later like brms
4 changes: 4 additions & 0 deletions R/parsnip-logistic_gam.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# logistic_gam() - General Interface to Logistic GAM Models
# - backend: mgcv
# - prediction: classification, type = class, type = prob.
# See ?predict.model_fit
14 changes: 14 additions & 0 deletions R/utils-pipe.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#' Pipe operator
#'
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
#' @param lhs A value or the magrittr placeholder.
#' @param rhs A function call using the magrittr semantics.
#' @return The result of calling `rhs(lhs)`.
NULL
47 changes: 47 additions & 0 deletions R/utils-tidy-eval.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#' Tidy eval helpers
#'
#' @description
#'
#' * \code{\link[rlang]{sym}()} creates a symbol from a string and
#' \code{\link[rlang:sym]{syms}()} creates a list of symbols from a
#' character vector.
#'
#' * \code{\link[rlang:nse-defuse]{enquo}()} and
#' \code{\link[rlang:nse-defuse]{enquos}()} delay the execution of one or
#' several function arguments. \code{enquo()} returns a single quoted
#' expression, which is like a blueprint for the delayed computation.
#' \code{enquos()} returns a list of such quoted expressions.
#'
#' * \code{\link[rlang:nse-defuse]{expr}()} quotes a new expression _locally_. It
#' is mostly useful to build new expressions around arguments
#' captured with [enquo()] or [enquos()]:
#' \code{expr(mean(!!enquo(arg), na.rm = TRUE))}.
#'
#' * \code{\link[rlang]{as_name}()} transforms a quoted variable name
#' into a string. Supplying something else than a quoted variable
#' name is an error.
#'
#' That's unlike \code{\link[rlang]{as_label}()} which also returns
#' a single string but supports any kind of R object as input,
#' including quoted function calls and vectors. Its purpose is to
#' summarise that object into a single label. That label is often
#' suitable as a default name.
#'
#' If you don't know what a quoted expression contains (for instance
#' expressions captured with \code{enquo()} could be a variable
#' name, a call to a function, or an unquoted constant), then use
#' \code{as_label()}. If you know you have quoted a simple variable
#' name, or would like to enforce this, use \code{as_name()}.
#'
#' To learn more about tidy eval and how to use these tools, visit
#' \url{https://tidyeval.tidyverse.org} and the
#' \href{https://adv-r.hadley.nz/metaprogramming.html}{Metaprogramming
#' section} of \href{https://adv-r.hadley.nz}{Advanced R}.
#'
#' @md
#' @name tidyeval
#' @keywords internal
#' @importFrom rlang expr enquo enquos sym syms .data := as_name as_label
#' @aliases expr enquo enquos sym syms .data := as_name as_label
#' @export expr enquo enquos sym syms .data := as_name as_label
NULL
31 changes: 31 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# gamsnip

<!-- badges: start -->
<!-- badges: end -->

The goal of gamsnip is to ...

## Installation

Development version:

``` r
# install.packages("devtools")
devtools::install_github("business-science/gamsnip")
```

18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# gamsnip

<!-- badges: start -->
<!-- badges: end -->

The goal of gamsnip is to …

## Installation

Development version:

``` r
# install.packages("devtools")
devtools::install_github("business-science/gamsnip")
```
5 changes: 5 additions & 0 deletions gamsnip.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
Binary file added man/figures/README-pressure-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions man/pipe.Rd

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

51 changes: 51 additions & 0 deletions man/tidyeval.Rd

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

4 changes: 4 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(testthat)
library(gamsnip)

test_check("gamsnip")
3 changes: 3 additions & 0 deletions tests/testthat/test-blah.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_that("multiplication works", {
expect_equal(2 * 2, 4)
})
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
19 changes: 19 additions & 0 deletions vignettes/getting-started.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Getting Started with gamsnip"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Getting Started with gamsnip}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```

```{r setup}
library(gamsnip)
```

0 comments on commit 599694f

Please sign in to comment.