https://github.com/DfE-R-Community/r-standalone
Self-contained scripts to be used with `usethis::use_standalone()`
https://github.com/DfE-R-Community/r-standalone
Last synced: 4 months ago
JSON representation
Self-contained scripts to be used with `usethis::use_standalone()`
- Host: GitHub
- URL: https://github.com/DfE-R-Community/r-standalone
- Owner: DfE-R-Community
- License: other
- Created: 2023-06-27T09:06:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-03T11:37:17.000Z (almost 2 years ago)
- Last Synced: 2024-08-13T07:11:08.822Z (8 months ago)
- Language: R
- Size: 40 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - DfE-R-Community/r-standalone - Self-contained scripts to be used with `usethis::use_standalone()` (R)
README
# Standalone R Functionality for the DfE
This repo houses self-contained R scripts which implement functionality commonly
used in DfE code. To import a standalone script into your own project, you can
simply copy/paste the code into your own repo, or alternatively (and preferably)
do so with {usethis}:``` r
# Will import R/sql-connections.R
usethis::use_standalone("DfE-R-Community/r-standalone", "sql-connections")# Will allow you to choose from available standalone scripts
usethis::use_standalone("DfE-R-Community/r-standalone")
```NB, while this repo uses a package structure, it should not typically be
installed by users - the package structure is used to facilitate development,
e.g. unit testing using {testthat}.## Contents
* [`academic_year`](R/standalone-academic_year.R): Implements a {vctrs} S3
class for working with academic years
* [`financial_year`](R/standalone-financial_year.R): Implements a {vctrs} S3
class for working with financial years
* [`sql-connections`](R/standalone-sql-connections.R): Easy-to-edit helpers for
connecting to databases and reading from SQL
* [`with_datatable`](R/standalone-with_datatable.R): Implements a single
function for translating {dplyr} code to use {data.table}, which is often
faster## Why Use Standalone Scripts?
Standalone scripts have several benefits over code contained in R packages:* Once imported, standalone scripts can be easily modified to suit individual
requirements* Standalone scripts can be updated more frequently, possibly with breaking
changes, without affecting existing users
* Each standalone script can have its own set of dependency packages, so
you only need to take on dependencies for the functionality you actually
use
## Dependencies
Standalone scripts may consider the following packages to be 'free' dependencies:* [cli](https://github.com/r-lib/cli)
* [glue](https://github.com/tidyverse/glue)
* [rlang](https://github.com/r-lib/rlang)
* [vctrs](https://github.com/r-lib/vctrs)
* [withr](https://github.com/r-lib/withr)