Learn R Programming

diyar (version 0.2.0)

combns: Generate every permutation of n elements.

Description

An extension of combn to generate permutations not ordinarily captured by combn. Each argument should be used as would be used in combn.

Usage

combns(x, m, FUN = NULL, simplify = TRUE, ...)

Arguments

x

Vector source for combination.

m

Number of elements required. Multiple counts can be supplied.

FUN

Function applied to each combination.

simplify

Logical indicating if the result should be simplified to an array or returned as a list.

...

further arguments passed to FUN. Optional.

Value

number_line.

Details

combns - Return every possible permutation of . An extension of combn.

Examples

Run this code
# NOT RUN {
f1 <- function(x) paste0(x, collapse = ",")
combn(x = 1:3, m = 3, FUN = f1, simplify = TRUE)
combns(x = 1:3, m = 3, FUN = f1, simplify = TRUE)
combns(x = 1:3, m = 1:3, FUN = f1, simplify = TRUE)

# }

Run the code above in your browser using DataLab