tidySet: Create a TidySet object

View source: R/tidy-set.R

tidySetR Documentation

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)

## S3 method for class 'TidySet'
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)

  • tidySet(data.frame): Given the relations in a data.frame

  • tidySet(list): Convert to a TidySet from a list.

  • tidySet(matrix): Convert an incidence matrix into a TidySet

  • tidySet(Go3AnnDbBimap): Convert Go3AnnDbBimap into a TidySet object.

  • tidySet(TidySet): Convert TidySet into a TidySet object.

See Also

TidySet

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 documentation built on Aug. 22, 2023, 5:11 p.m.