some | R Documentation |
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.
some(x, ...)
## S3 method for class 'data.frame'
some(x, n=10, cols=NULL, ...)
## S3 method for class 'matrix'
some(x, n=10, cols=NULL, ...)
## Default S3 method:
some(x, n=10, ...)
x |
the object to be sampled. |
n |
number of elements to sample. |
cols |
if |
... |
arguments passed down. |
Sampled elements or rows.
These functions are adapted from head
and tail
in the utils
package.
John Fox jfox@mcmaster.ca
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
head
, tail
, brief
.
some(Duncan)
some(Duncan, cols=names(Duncan)[1:3])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.