Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tidySet

Create a TidySet object


Description

These functions help to create a TidySet object from data.frame, list, matrix, and GO3AnnDbBimap. They can create both fuzzy and standard sets.

Usage

tidySet(relations)

## S3 method for class 'data.frame'
tidySet(relations)

## S3 method for class 'list'
tidySet(relations)

## S3 method for class 'matrix'
tidySet(relations)

## S3 method for class 'Go3AnnDbBimap'
tidySet(relations)

Arguments

relations

An object to be coerced to a TidySet.

Details

Elements or sets without any relation are not shown when printed.

Value

A TidySet object.

Methods (by class)

  • data.frame: Given the relations in a data.frame

  • list: Convert to a TidySet from a list

  • matrix: Convert an incidence matrix into a TidySet

  • Go3AnnDbBimap: Convert Go3AnnDbBimap into a TidySet object.

See Also

Examples

relations <- data.frame(
    sets = c(rep("a", 5), "b"),
    elements = letters[seq_len(6)]
)
tidySet(relations)
relations2 <- data.frame(
    sets = c(rep("A", 5), "B"),
    elements = letters[seq_len(6)],
    fuzzy = runif(6)
)
tidySet(relations2)
# A
x <- list("A" = letters[1:5], "B" = LETTERS[3:7])
tidySet(x)
# A fuzzy set taken encoded as a list
A <- runif(5)
names(A) <- letters[1:5]
B <- runif(5)
names(B) <- letters[3:7]
relations <- list(A, B)
tidySet(relations)
# Will error
# x <- list("A" = letters[1:5], "B" = LETTERS[3:7], "c" = runif(5))
# a <- tidySet(x) # Only characters or factors are allowed as elements.
M <- matrix(c(1, 0.5, 1, 0), ncol = 2,
            dimnames = list(c("A", "B"), c("a", "b")))
tidySet(M)

BaseSet

Working with Sets the Tidy Way

v0.0.16
MIT + file LICENSE
Authors
Lluís Revilla Sancho [aut, cre] (<https://orcid.org/0000-0001-9747-2570>), Zebulun Arendsee [rev], Jennifer Chang [rev]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.