Skip to content

Commit

Permalink
INITIAL
Browse files Browse the repository at this point in the history
  • Loading branch information
FlippieCoetser committed Oct 1, 2023
1 parent 0aaa872 commit 4dc5e4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 84 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: R.Template
Title: Package Tile
Package: Validate
Title: Generic Validations
Version: 0.0.1.0000
Authors@R:
person(given = "Flippie",
family = "Coetser",
role = c("aut", "cre"),
email = "Flippie.Coetser@gmail.com",
comment = c(ORCID = "0000-0003-0549-9245"))
Description: Packge Description.
Description: Generic set of Validations and Exceptions used by most packages.
License: file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
72 changes: 1 addition & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1 @@
# R Package Template

This repository can be used as a boilerplate when creating a new R package. It contains a basic package structure and a few valuable files to get started.

Unique feature included in this template:

1. A basic unit testing framework using `testthat`.
2. A basic documentation framework using `roxygen2`.
3. Github Actions for CI/CD.

## Using Template

To use this template to create your own R-Package, follow these steps:

1. R `devtools` is required when developing R packages. Install and Reboot:

```r
install.packages("devtools")
```

2. Install the unit testing framework `testthat`:

```r
install.packages("testthat")
```

3. Create new Repository: click the `Use this template` button to create a new repository.

4. Clone Repository

```bash
git clone <Repo URL>
```

5. Update `README.md`
6. Update `DESCRIPTION`
7. Update `tests/testthat/testthat.R`: change the reference in `library()` and `test_check()` with your package name.
8. Update documentation using `devtools` in r terminal

```r
devtools::document()
```

7. Check the Package using `devtools` in r terminal

```r
devtools::check()
```

## Template Architecture

### Folder Structure

By design, R packages leverage a specific folder structure. This structure is used by `devtools` to document, check and build packages.
Here is an overview of the different files and folders that comprise the package structure.

Files:

- `DESCRIPTION`: Contains the package metadata. This file defines the package name, version, dependencies and other metadata.
- `NAMESPACE`: Contains the package namespace. This file is used to define the package exports and imports.
- `LICENSE`: Contains the package license. This file is used to define the package license.
- `README.md`: Contains the package readme. This file is used to provide a high-level overview of the package.

Folders:

- `man`: Contains the documentation files. These files are generated by `devtools` and should not be edited manually.
- `R`: Contains the R source code files. These files define the functions and data structures that make up the package.
- `tests`: Contains the unit tests. These files test the functions and data structures that make up the package.
- `vignettes`: Contains the vignettes. These files are used to provide additional documentation and examples.

Most of your time developing R packages will be spent in the R and Tests folders. Files in `man` and `vignettes` are generated by `devtools` and should not be edited manually. Also, the contents in the `NAMESPACE` file should not be edited manually.
# Validate
12 changes: 2 additions & 10 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
# 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/tests.html
# * https://testthat.r-lib.org/reference/test_package.html#special-files

library(testthat)
library(R.Template)
library(Validate)

test_check("R.Template")
test_check("Validate")

0 comments on commit 4dc5e4d

Please sign in to comment.