sample.all: All Sampling Variations/Permutations

View source: R/sample.all.R

sample.allR Documentation

All Sampling Variations/Permutations

Description

sample.all returns a matrix of all sampling variations/permutations from a set of integers

Usage

sample.all(n, size = n, replace = FALSE, prob = NULL)

Arguments

n

Number of integers to sample from

size

Length of the sample vectors

replace

Logical value; if FALSE the sampling is without replacement; if TRUE the sampling is with replacement

prob

Probability vector giving the sampling probability for each element (must be a probability vector with length n)

Details

This function computes all sample vectors of size size composed of the elements 1, ..., n, either with or without replacement of elements. If size = n and replace = TRUE then the list of all sample vectors corresponds to a list of all permutations of the integers 1, ..., n.

Value

A matrix of all permutations of the elements 1, ..., n (rows of the matrix give the permutations)

Examples

sample.all(n = 4, replace = FALSE)

utilities documentation built on July 1, 2022, 9:06 a.m.