{"id":14068517,"url":"https://github.com/xoopR/set6","last_synced_at":"2025-07-30T04:31:14.553Z","repository":{"id":46071581,"uuid":"197164551","full_name":"xoopR/set6","owner":"xoopR","description":"R6 object-oriented interface for mathematical sets.","archived":true,"fork":false,"pushed_at":"2023-09-29T09:32:29.000Z","size":1901,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-14T20:31:40.739Z","etag":null,"topics":["intervals","oop","r","r6","sets"],"latest_commit_sha":null,"homepage":"https://xoopR.github.io/set6/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xoopR.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2019-07-16T09:36:22.000Z","updated_at":"2024-02-23T14:59:22.000Z","dependencies_parsed_at":"2023-09-29T12:01:50.636Z","dependency_job_id":null,"html_url":"https://github.com/xoopR/set6","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/xoopR/set6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoopR%2Fset6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoopR%2Fset6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoopR%2Fset6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoopR%2Fset6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xoopR","download_url":"https://codeload.github.com/xoopR/set6/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoopR%2Fset6/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265535180,"owners_count":23783985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["intervals","oop","r","r6","sets"],"created_at":"2024-08-13T07:06:14.095Z","updated_at":"2025-07-30T04:31:14.227Z","avatar_url":"https://github.com/xoopR.png","language":"R","readme":"---\ntitle: \"set6\"\noutput: github_document\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(collapse = TRUE, comment = \"#\u003e\")\nlibrary(set6)\nset.seed(42)\n```\n\n\u003cimg src=\"man/figures/logo.png\" align=\"right\" alt=\"\" width=\"120\" /\u003e\n\n[![set6 status badge](https://raphaels1.r-universe.dev/badges/set6)](https://raphaels1.r-universe.dev)\n[![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)\n[![codecov](https://app.codecov.io/gh/xoopR/set6/branch/master/graph/badge.svg)](https://app.codecov.io/gh/xoopR/set6)\n[![CodeFactor](https://www.codefactor.io/repository/github/xoopr/set6/badge)](https://www.codefactor.io/repository/github/xoopr/set6)\n[![dependencies](https://tinyverse.netlify.com/badge/set6)](https://CRAN.R-project.org/package=set6)\n\n[![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![Lifecycle Badge](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://img.shields.io/badge/lifecycle-stable-brightgreen)\n\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/set6)](https://cran.r-project.org/package=set6)\n\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.02598/status.svg)](https://doi.org/10.21105/joss.02598)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Gitter chat](https://badges.gitter.im/xoopR/set6.png)](https://gitter.im/xoopR/set6)\n\n## What is set6?\n\n`set6` is an R6 upgrade to the `sets` package in R that includes:\n\n* Multi-dimensional sets\n* Tuples\n* Finite and infinite intervals\n* Fuzzy sets and tuples\n* Set operations including union, intersect, (asymmetric and symmetric) difference, and product\n* Symbolic representation of infinite sets including common special sets such as the Reals and Integers\n* ConditionalSets for defining sets according to logical conditions\n\n## Installation\n\nThe current CRAN release can be installed with\n```{r,eval=FALSE}\ninstall.packages(\"set6\")\n```\nOr for the latest stable build\n\n```{r,eval=FALSE}\nremotes::install_github(\"xoopR/set6\")\n```\n\n## Main Features\n\n### A Clear Inheritance Structure\n\n```{r}\n# Sets require elements to be unique and order doesn't matter\nSet$new(1, 2, 1) == Set$new(1, 2)\nSet$new(1, 2) == Set$new(2, 1)\n\n# But tuples can enforce these restrictions\nTuple$new(1, 2, 1) != Tuple$new(1, 2)\nTuple$new(1, 2) != Tuple$new(2, 1)\n\n# Fuzzy sets and tuples extend sets further\nf = FuzzySet$new(1, 0, 2, 0.6, 3, 1)\nf$inclusion(1)\nf$inclusion(2)\nf$inclusion(3)\n\n# Symbolic intervals provide a clean way to represent infinite sets\nInterval$new()\n# Different closure types and classes are possible\nInterval$new(1, 7, type = \"(]\") # half-open\nInterval$new(1, 7, class = \"integer\") == Set$new(1:7)\n\n# And SpecialSets inheriting from these intervals\nReals$new()\nPosRationals$new()\n```\n\n### Set operations\n```{r}\n# Union\nSet$new(1, 4, \"a\", \"b\") + Set$new(5)\nInterval$new(1, 5) + FuzzyTuple$new(1, 0.6)\n\n# Power\nSet$new(1:5)^2\n# A symbolic representation is also possible\nsetpower(Set$new(1:5), power = 2, simplify = FALSE)\nReals$new()^5\n\n# Product\nSet$new(1,2) * Set$new(5, 6)\nInterval$new(1,5) * Tuple$new(3)\n\n# Intersection\nSet$new(1:5) \u0026 Set$new(4:10)\nConditionalSet$new(function(x) x == 0) \u0026 Set$new(-2:2)\nInterval$new(1, 10) \u0026 Set$new(5:6)\n\n# Difference\nInterval$new(1, 10) - Set$new(5)\nSet$new(1:5) - Set$new(2:3)\n```\n\n### Containedness and Comparators\n```{r}\nInterval$new(1, 10)$contains(5)\n# check multiple elements\nInterval$new(1, 10)$contains(8:12)\n# only return TRUE if all are TRUE\nInterval$new(1, 10)$contains(8:12, all = TRUE)\n# decide whether open bounds should be included\nInterval$new(1, 10, type = \"()\")$contains(10, bound = TRUE)\nInterval$new(1, 10, type = \"()\")$contains(10, bound = TRUE)\n\nInterval$new(1, 5, class = \"numeric\")$equals(Set$new(1:5))\nInterval$new(1, 5, class = \"integer\")$equals(Set$new(1:5))\n\nSet$new(1) == FuzzySet$new(1, 1)\n\n# proper subsets\nSet$new(1:3)$isSubset(Set$new(1), proper = TRUE)\nSet$new(1) \u003c Set$new(1:3)\n\n# (non-proper) subsets\nSet$new(1:3)$isSubset(Set$new(1:3), proper = FALSE)\nSet$new(1:3) \u003c= Set$new(1:3)\n\n# multi-dimensional checks\nx = PosReals$new()^2\nx$contains(list(Tuple$new(1, 1), Tuple$new(-2, 3)))\n```\n\n## Usage\n\nThe primary use-cases of `set6` are:\n\n1. **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.\n2. **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.\n\n## Short-term development plans\n\nWhilst 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\n\n* 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.\n* 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.\n* There are known bottlenecks that need to be fixed to massively improve speed and efficiency.\n* Adding more tutorials to make the interface easier for beginners, especially people new to R6\n\nAt a later stage we may consider adding Venn diagrams for visualisation of sets and intervals, but this is very low priority.\n\n## Similar Packages\n\n* [sets](https://CRAN.R-project.org/package=sets) - The **sets** package uses S3 to define some symbolic representaton of mathematical sets,\ntuple, intervals, and fuzzy variants. However the symbolic representation is not consistent throughout\nthe package, does not allow for clear inspection of set/interval elements, and there is no support for\nmulti-dimensional sets.\n\n* [BaseSet](https://github.com/ropensci/BaseSet) - The **BaseSet** package focuses on storing and analysing\nsets in a 'tidy' way, with more options for data storage in long and wide formats. The primary usage is\nneat and efficient inspection of finite sets, there is no support for infinite sets or symbolic\nrepresentation.\n\n## Contributing\n\nAs `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.\n\n## Citing set6\n\nIf you use set6, please cite our [JOSS article](https://doi.org/10.21105/joss.02598):\n\n@Article{set6,\n  title = {set6: R6 Mathematical Sets Interface},\n  author = {Raphael Sonabend and Franz J. Kiraly},\n  journal = {Journal of Open Source Software},\n  year = {2020},\n  month = {nov},\n  doi = {10.21105/joss.02598},\n  url = {https://joss.theoj.org/papers/10.21105/joss.02598},\n}\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FxoopR%2Fset6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FxoopR%2Fset6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FxoopR%2Fset6/lists"}