R - Sample

> Procedural Languages > R

1 - About

Sample is a function that return a random subset of a data set.

Advertising

3 - Example

set.seed(1)
# random subset of the original data so that N=15
sample = data[sample(nrow(data), 15), ]

where: