some: Sample a Few Elements of an Object

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/some.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
some(x, ...)

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

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

## Default S3 method:
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.

Note

These functions are adapted from head and tail in the utils package.

Author(s)

John Fox jfox@mcmaster.ca

References

Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.

See Also

head, tail.

Examples

1

jonathon-love/car documentation built on May 19, 2019, 7:28 p.m.