sample: Random Samples and Permutations

Description Usage Arguments Value Author(s) See Also Examples

Description

Provides the generic function sample and the S4 method to take a sample of the specified size from the elements of x using either with or without replacement. sample can be used to sample from a set of transactions or associations.

Usage

1
sample(x, size, replace = FALSE, prob = NULL, ...)

Arguments

x

object to be sampled from (a set of associations or transactions).

size

sample size.

replace

a logical. Sample with replacement?

prob

a numeric vector of probability weights.

...

further arguments.

Value

An object of the same class as x.

Author(s)

Michael Hahsler

See Also

associations-class, transactions-class, itemMatrix-class.

Examples

1
2
3
4
5
data("Adult")

## sample with replacement
s <- sample(Adult, 500, replace = TRUE)
s

arules documentation built on May 29, 2017, 3:27 p.m.

Search within the arules package
Search all R packages, documentation and source code