choose: Returns one or n random elements of your list or dataset

View source: R/choose.R

chooseR Documentation

Returns one or n random elements of your list or dataset

Description

This function allows you to choose easily random elements of your dataset.

Usage

choose(x = NULL, n = 1, replace = FALSE)

Arguments

x

dataset (array or data frame) where to choose from

n

number of choices (sample size)

replace

sample with replacement or not. Default is FALSE.

Value

object

Examples

# Choose a random number between 1 and 3
choose(c(1,2,3))

dominikjung42/dstools documentation built on June 16, 2024, 2:40 a.m.