car (version 1.1-2)

some: Sample a Few Elements of an Object

Description

Randomly select a few elements of an object, typically a data frame, matrix, vector, or list. If the object is a data frame or a matrix, then rows are sampled.

Usage

some(x, ...)

## S3 method for class 'data.frame':
some(x, n=10, ...)

## S3 method for class 'matrix':
some(x, n=10, ...)

## S3 method for class 'default':
some(x, n=10, ...)

Arguments

x
the object to be sampled.
n
number of elements to sample.
...
arguments passed down.

Value

  • Sampled elements or rows.

See Also

head, tail.

Examples

Run this code
some(data.frame(z=rnorm(100), u=runif(100)))

Run the code above in your browser using DataCamp Workspace