diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..7920c7c --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,5 @@ +^toy-package\.Rproj$ +^\.Rproj\.user$ +^codecov\.yml$ +^README\.Rmd$ +^LICENSE\.md$ diff --git a/.gitignore b/.gitignore index e75435c..7cc8b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ po/*~ # RStudio Connect folder rsconnect/ +.Rproj.user diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..951f469 --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,13 @@ +Package: toypackage +Title: What the Package Does (One Line, Title Case) +Version: 0.0.0.9000 +Authors@R: + person("Daniel", "Sabanes Bove", , "daniel@rconis.com", role = c("aut", "cre")) +Description: What the package does (one paragraph). +License: MIT + file LICENSE +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.2 +Suggests: + testthat (>= 3.0.0) +Config/testthat/edition: 3 diff --git a/LICENSE b/LICENSE index eb84792..5809a06 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2024 RCONIS - -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. +YEAR: 2024 +COPYRIGHT HOLDER: toypackage authors diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..64d7b20 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2024 toypackage authors + +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. diff --git a/NAMESPACE b/NAMESPACE new file mode 100644 index 0000000..472df55 --- /dev/null +++ b/NAMESPACE @@ -0,0 +1,4 @@ +# Generated by roxygen2: do not edit by hand + +export(foo) +export(toy) diff --git a/R/dummy.R b/R/dummy.R new file mode 100644 index 0000000..e808ba4 --- /dev/null +++ b/R/dummy.R @@ -0,0 +1,13 @@ +#' Test function +#' +#' @param x first number. +#' @param y second number. +#' +#' @return The sum. +#' @export +#' +#' @examples +#' foo(1, 2) +foo <- function(x, y) { + x + y +} diff --git a/R/toy.R b/R/toy.R new file mode 100644 index 0000000..b897614 --- /dev/null +++ b/R/toy.R @@ -0,0 +1,13 @@ +#' Toy function +#' +#' @param x first number. +#' @param y second number. +#' +#' @return The product +#' @export +#' +#' @examples +#' toy(1, 2) +toy <- function(x, y) { + x * y +} diff --git a/README.Rmd b/README.Rmd new file mode 100644 index 0000000..b74100f --- /dev/null +++ b/README.Rmd @@ -0,0 +1,56 @@ +--- +output: github_document +--- + + + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>", + fig.path = "man/figures/README-", + out.width = "100%" +) +``` + +# toypackage + + +[![Codecov test coverage](https://codecov.io/gh/RCONIS/toy-package/graph/badge.svg)](https://app.codecov.io/gh/RCONIS/toy-package) + + +The goal of toypackage is to ... + +## Installation + +You can install the development version of toypackage from [GitHub](https://github.com/) with: + +``` r +# install.packages("pak") +pak::pak("RCONIS/toy-package") +``` + +## Example + +This is a basic example which shows you how to solve a common problem: + +```{r example} +library(toypackage) +## basic example code +``` + +What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: + +```{r cars} +summary(cars) +``` + +You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. + +You can also embed plots, for example: + +```{r pressure, echo = FALSE} +plot(pressure) +``` + +In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN. diff --git a/README.md b/README.md index 3327ba1..4072f8f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# toy-package +# toypackage Toy R package for exploration diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..04c5585 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true diff --git a/man/foo.Rd b/man/foo.Rd new file mode 100644 index 0000000..290b903 --- /dev/null +++ b/man/foo.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dummy.R +\name{foo} +\alias{foo} +\title{Test function} +\usage{ +foo(x, y) +} +\arguments{ +\item{x}{first number.} + +\item{y}{second number.} +} +\value{ +The sum. +} +\description{ +Test function +} +\examples{ +foo(1, 2) +} diff --git a/man/toy.Rd b/man/toy.Rd new file mode 100644 index 0000000..990630f --- /dev/null +++ b/man/toy.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/toy.R +\name{toy} +\alias{toy} +\title{Toy function} +\usage{ +toy(x, y) +} +\arguments{ +\item{x}{first number.} + +\item{y}{second number.} +} +\value{ +The product +} +\description{ +Toy function +} +\examples{ +toy(1, 2) +} diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..06a682a --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,12 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + +library(testthat) +library(toypackage) + +test_check("toypackage") diff --git a/tests/testthat/test-dummy.R b/tests/testthat/test-dummy.R new file mode 100644 index 0000000..8849056 --- /dev/null +++ b/tests/testthat/test-dummy.R @@ -0,0 +1,3 @@ +test_that("multiplication works", { + expect_equal(2 * 2, 4) +}) diff --git a/toy-package.Rproj b/toy-package.Rproj new file mode 100644 index 0000000..69fafd4 --- /dev/null +++ b/toy-package.Rproj @@ -0,0 +1,22 @@ +Version: 1.0 + +RestoreWorkspace: No +SaveWorkspace: No +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes +LineEndingConversion: Posix + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace