nChooseK: n Choose k

View source: R/nChooseK.R

nChooseKR Documentation

n Choose k

Description

Given 'n' elements and combinations of size 'k', find number of unique combinations.

Usage

nChooseK(n_v, k_v)

Arguments

n_v

number of possible elements to create combinations

k_v

size of combinations (e.g. 3 means all unique combinations of 3 elements from n_v)

Value

numeric vector listing the total number of combinations

Examples

set.seed(1)
n_v <- sample(1:50, size = 5)
k1_v <- 3; k2_v <- 5
nChooseK(n_v[1], k1_v)
nChooseK(n_v[1], k2_v)
nChooseK(n_v, k1_v)
nChooseK(n_v, k2_v)

weshorton/wrh.rUtils documentation built on Oct. 28, 2024, 7:24 a.m.