set6

set6: R6 Mathematical Sets Interface - Published in JOSS (2020)

https://github.com/xoopr/set6

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

intervals oop r r6 sets

Keywords from Contributors

mlr3
Last synced: 4 months ago · JSON representation

Repository

R6 object-oriented interface for mathematical sets.

Basic Info
Statistics
  • Stars: 14
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 13
Archived
Topics
intervals oop r r6 sets
Created over 6 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog License Codemeta

README.Rmd

---
title: "set6"
output: github_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(set6)
set.seed(42)
```



[![set6 status badge](https://raphaels1.r-universe.dev/badges/set6)](https://raphaels1.r-universe.dev)
[![R CMD Check via {tic}](https://github.com/xoopR/set6/workflows/R%20CMD%20Check%20via%20%7Btic%7D/badge.svg?branch=master)](https://github.com/xoopR/set6/actions)
[![codecov](https://app.codecov.io/gh/xoopR/set6/branch/master/graph/badge.svg)](https://app.codecov.io/gh/xoopR/set6)
[![CodeFactor](https://www.codefactor.io/repository/github/xoopr/set6/badge)](https://www.codefactor.io/repository/github/xoopr/set6)
[![dependencies](https://tinyverse.netlify.com/badge/set6)](https://CRAN.R-project.org/package=set6)

[![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Lifecycle Badge](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://img.shields.io/badge/lifecycle-stable-brightgreen)

[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/set6)](https://cran.r-project.org/package=set6)

[![DOI](https://joss.theoj.org/papers/10.21105/joss.02598/status.svg)](https://doi.org/10.21105/joss.02598)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Gitter chat](https://badges.gitter.im/xoopR/set6.png)](https://gitter.im/xoopR/set6)

## What is set6?

`set6` is an R6 upgrade to the `sets` package in R that includes:

* Multi-dimensional sets
* Tuples
* Finite and infinite intervals
* Fuzzy sets and tuples
* Set operations including union, intersect, (asymmetric and symmetric) difference, and product
* Symbolic representation of infinite sets including common special sets such as the Reals and Integers
* ConditionalSets for defining sets according to logical conditions

## Installation

The current CRAN release can be installed with
```{r,eval=FALSE}
install.packages("set6")
```
Or for the latest stable build

```{r,eval=FALSE}
remotes::install_github("xoopR/set6")
```

## Main Features

### A Clear Inheritance Structure

```{r}
# Sets require elements to be unique and order doesn't matter
Set$new(1, 2, 1) == Set$new(1, 2)
Set$new(1, 2) == Set$new(2, 1)

# But tuples can enforce these restrictions
Tuple$new(1, 2, 1) != Tuple$new(1, 2)
Tuple$new(1, 2) != Tuple$new(2, 1)

# Fuzzy sets and tuples extend sets further
f = FuzzySet$new(1, 0, 2, 0.6, 3, 1)
f$inclusion(1)
f$inclusion(2)
f$inclusion(3)

# Symbolic intervals provide a clean way to represent infinite sets
Interval$new()
# Different closure types and classes are possible
Interval$new(1, 7, type = "(]") # half-open
Interval$new(1, 7, class = "integer") == Set$new(1:7)

# And SpecialSets inheriting from these intervals
Reals$new()
PosRationals$new()
```

### Set operations
```{r}
# Union
Set$new(1, 4, "a", "b") + Set$new(5)
Interval$new(1, 5) + FuzzyTuple$new(1, 0.6)

# Power
Set$new(1:5)^2
# A symbolic representation is also possible
setpower(Set$new(1:5), power = 2, simplify = FALSE)
Reals$new()^5

# Product
Set$new(1,2) * Set$new(5, 6)
Interval$new(1,5) * Tuple$new(3)

# Intersection
Set$new(1:5) & Set$new(4:10)
ConditionalSet$new(function(x) x == 0) & Set$new(-2:2)
Interval$new(1, 10) & Set$new(5:6)

# Difference
Interval$new(1, 10) - Set$new(5)
Set$new(1:5) - Set$new(2:3)
```

### Containedness and Comparators
```{r}
Interval$new(1, 10)$contains(5)
# check multiple elements
Interval$new(1, 10)$contains(8:12)
# only return TRUE if all are TRUE
Interval$new(1, 10)$contains(8:12, all = TRUE)
# decide whether open bounds should be included
Interval$new(1, 10, type = "()")$contains(10, bound = TRUE)
Interval$new(1, 10, type = "()")$contains(10, bound = TRUE)

Interval$new(1, 5, class = "numeric")$equals(Set$new(1:5))
Interval$new(1, 5, class = "integer")$equals(Set$new(1:5))

Set$new(1) == FuzzySet$new(1, 1)

# proper subsets
Set$new(1:3)$isSubset(Set$new(1), proper = TRUE)
Set$new(1) < Set$new(1:3)

# (non-proper) subsets
Set$new(1:3)$isSubset(Set$new(1:3), proper = FALSE)
Set$new(1:3) <= Set$new(1:3)

# multi-dimensional checks
x = PosReals$new()^2
x$contains(list(Tuple$new(1, 1), Tuple$new(-2, 3)))
```

## Usage

The primary use-cases of `set6` are:

1. **Upgrading sets** Extend the R `sets` package to R6, which allows for generalised `Set` objects with a clear inheritance structure. As well as adding features including symbolic representation of infinite sets, and cartesian products.
2. **Defining parameter interfaces** All objects inheriting from the `Set` parent class include methods `equals` and `contains`, which are used to check if two sets are equal or if elements lie in the given set. This makes `set6` ideal for parameter interfaces in which a range of values (possibly multi-dimensional or of mixed types) need to be defined.

## Short-term development plans

Whilst the `set6` API is stable, it is considered 'maturing', and therefore whilst there are no plans for major updates, these may still occur. There are a few features and refactoring we plan on implementing before we consider the package to be in its first complete version. These mainly include

* Finalising all methods and fields - some are missing or possibly inaccurate for some wrappers. For example the cardinality of `ComplementSet`s is imprecise at the moment.
* We are considering adding a `simplify` method to wrappers to reduce classes inheriting from `SetWrapper` to simpler sets. This allows users to perform operations with `simplify = FALSE` and then to change their mind.
* There are known bottlenecks that need to be fixed to massively improve speed and efficiency.
* Adding more tutorials to make the interface easier for beginners, especially people new to R6

At a later stage we may consider adding Venn diagrams for visualisation of sets and intervals, but this is very low priority.

## Similar Packages

* [sets](https://CRAN.R-project.org/package=sets) - The **sets** package uses S3 to define some symbolic representaton of mathematical sets,
tuple, intervals, and fuzzy variants. However the symbolic representation is not consistent throughout
the package, does not allow for clear inspection of set/interval elements, and there is no support for
multi-dimensional sets.

* [BaseSet](https://github.com/ropensci/BaseSet) - The **BaseSet** package focuses on storing and analysing
sets in a 'tidy' way, with more options for data storage in long and wide formats. The primary usage is
neat and efficient inspection of finite sets, there is no support for infinite sets or symbolic
representation.

## Contributing

As `set6` is in its early stages, contributions are very welcome. If you have any ideas for good features please open an issue or create a pull request. Otherwise bug reports are very appreciated if you stumble across any broken code, these can be posted to the [issue tracker](https://github.com/xoopR/set6/issues). For updates on `set6` follow/star this repo.

## Citing set6

If you use set6, please cite our [JOSS article](https://doi.org/10.21105/joss.02598):

@Article{set6,
  title = {set6: R6 Mathematical Sets Interface},
  author = {Raphael Sonabend and Franz J. Kiraly},
  journal = {Journal of Open Source Software},
  year = {2020},
  month = {nov},
  doi = {10.21105/joss.02598},
  url = {https://joss.theoj.org/papers/10.21105/joss.02598},
}

Owner

  • Name: xoop
  • Login: xoopR
  • Kind: organization
  • Location: London, UK

xoop is a universe of packages for class object-oriented programming in R.

JOSS Publication

set6: R6 Mathematical Sets Interface
Published
November 12, 2020
Volume 5, Issue 55, Page 2598
Authors
Raphael Sonabend ORCID
Department of Statistical Science, University College London
Franz J. Kiraly
Department of Statistical Science, University College London
Editor
David P. Sanders ORCID
Tags
statistics sets object-oriented

CodeMeta (codemeta.json)

{
  "@context": [
    "https://doi.org/10.5063/schema/codemeta-2.0",
    "http://schema.org"
  ],
  "@type": "SoftwareSourceCode",
  "identifier": "set6",
  "description": "An object-oriented package for mathematical sets, upgrading the current gold-standard {sets}. Many forms of mathematical sets are implemented, including (countably finite) sets, tuples, intervals (countably infinite or uncountable), and fuzzy variants. Wrappers extend functionality by allowing symbolic representations of complex operations on sets, including unions, (cartesian) products, exponentiation, and differences (asymmetric and symmetric).",
  "name": "set6: R6 Mathematical Sets Interface",
  "codeRepository": "https://github.com/xoopR/set6",
  "relatedLink": [
    "https://raphaels1.github.io/set6/",
    "https://CRAN.R-project.org/package=set6",
    "https://xoopR.github.io/set6/"
  ],
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.1.3.9000",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "version": "3.6.2",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 3.6.2 (2019-12-12)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Raphael",
      "familyName": "Sonabend",
      "email": "raphael.sonabend.15@ucl.ac.uk",
      "@id": "https://orcid.org/0000-0001-9225-4654"
    },
    {
      "@type": "Person",
      "givenName": "Franz",
      "familyName": "Kiraly",
      "email": "f.kiraly@ucl.ac.uk"
    }
  ],
  "contributor": {},
  "copyrightHolder": {},
  "funder": {},
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Raphael",
      "familyName": "Sonabend",
      "email": "raphael.sonabend.15@ucl.ac.uk",
      "@id": "https://orcid.org/0000-0001-9225-4654"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "knitr",
      "name": "knitr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=knitr"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "devtools",
      "name": "devtools",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=devtools"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "rmarkdown",
      "name": "rmarkdown",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rmarkdown"
    }
  ],
  "softwareRequirements": [
    {
      "@type": "SoftwareApplication",
      "identifier": "checkmate",
      "name": "checkmate",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=checkmate"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "R6",
      "name": "R6",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=R6"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "utils",
      "name": "utils"
    }
  ],
  "releaseNotes": "https://github.com/xoopR/set6/blob/master/NEWS.md",
  "readme": "https://github.com/xoopR/set6/blob/master/README.md",
  "fileSize": "125.516KB",
  "contIntegration": [
    "https://travis-ci.com/RaphaelS1/set6",
    "https://ci.appveyor.com/project/RaphaelS1/set6",
    "https://codecov.io/gh/RaphaelS1/set6"
  ],
  "developmentStatus": "https://img.shields.io/badge/lifecycle-maturing-blue",
  "issueTracker": "https://github.com/xoopR/set6/issues"
}

GitHub Events

Total
Last Year

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 288
  • Total Committers: 3
  • Avg Commits per committer: 96.0
  • Development Distribution Score (DDS): 0.111
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Raphael r****5@u****k 256
RaphaelS1 r****d@g****m 27
GitHub n****y@g****m 5
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 58
  • Total pull requests: 17
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 7
  • Total pull request authors: 1
  • Average comments per issue: 0.81
  • Average comments per pull request: 0.53
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RaphaelS1 (52)
  • wch (1)
  • dmbates (1)
  • urswilke (1)
  • dpsanders (1)
  • watashiwa-toki (1)
  • MrShoenel (1)
Pull Request Authors
  • RaphaelS1 (18)
Top Labels
Issue Labels
enhancement (12) bug (8) Priority: High (6) good first issue (6) Priority: Low (3) Priority: Medium (2) documentation (2)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total docker downloads: 42,158
  • Total dependent packages: 5
    (may contain duplicates)
  • Total dependent repositories: 6
    (may contain duplicates)
  • Total versions: 19
cran.r-project.org: set6

R6 Mathematical Sets Interface

  • Versions: 14
  • Dependent Packages: 3
  • Dependent Repositories: 6
  • Downloads: 0
  • Docker Downloads: 42,158
Rankings
Dependent packages count: 11.3%
Dependent repos count: 12.7%
Stargazers count: 15.1%
Forks count: 28.8%
Average: 31.5%
Downloads: 89.7%
Last synced: 4 months ago
conda-forge.org: r-set6
  • Versions: 5
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent packages count: 19.5%
Dependent repos count: 34.0%
Average: 40.7%
Stargazers count: 48.3%
Forks count: 61.1%
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • R6 * imports
  • Rcpp * imports
  • checkmate * imports
  • ooplah * imports
  • utils * imports
  • devtools * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/pkgdown.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • r-lib/actions/setup-pandoc master composite
  • r-lib/actions/setup-r master composite
.github/workflows/rcmdcheck.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite