subsets {oeli}R Documentation

Generate vector subsets

Description

This function generates subsets of a vector.

Usage

subsets(v, n = seq_along(v))

Arguments

v

A vector (numeric or character).

n

An integer vector with the required subset sizes. By default, n = seq_along(v), i.e., all subsets of v are generated.

Value

A list, each element is a subset of v.

Examples

v <- 1:3
subsets(v)
subsets(v, c(1, 3)) # only subsets of length 1 or 3
subsets(integer())  # trivial case works

[Package oeli version 0.5.2 Index]