Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elipousson/isstatic

A R package for Dependency-Free Object Tests
https://github.com/elipousson/isstatic

rpackage rstats

Last synced: 27 days ago
JSON representation

A R package for Dependency-Free Object Tests

Awesome Lists containing this project

README

        

---
output: github_document
---

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

# isstatic

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![License: CC0-1.0](https://img.shields.io/badge/License-CC0_1.0-brightgreen.svg)](http://creativecommons.org/publicdomain/zero/1.0/)

The goal of isstatic is to provide a convenient set of static functions for checking object class inheritance, regex pattern matching, extracting attributes, and basic type conversion.

I've used and reused these functions across a number of different packages so using [staticimports](https://github.com/wch/staticimports) is also intended as a way to keep those functions standardized across projects. This package is inspired by the [stringstatic](https://github.com/rossellhayes/stringstatic/) package by Alex Rossell Hayes.

## Installation

You can install the development version of isstatic like so:

``` r
pak::pkg_install("elipousson/isstatic")
```
## Usage

To import functions from `isstatic` into your package, put a comment block starting with `# @staticimports pkg:isstatic` in one of your R source files.

For example, your `utils.R` file may have this at the top:

```
# @staticimports pkg:isstatic
# is_sf is_bbox is_url
```

`pkg:isstatic` means you will import functions from the `stringstatic` package.
You can find many other useful functions in [`pkg:staticimports`](https://github.com/wch/staticimports).

Subsequent lines list the objects to import from the package.
In this case, they are `is_sf()`, `is_bbox()` and `is_url()`.

To perform the import, run:

```r
staticimports::import()
```

By default, this will write the functions to an `R/staticimports.R` file in your project.