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:

lang/r/sample.txt · Last modified: 2017/09/13 16:04 by gerardnico