head
and tail
. Sometimes one might want to see more randomly scattered elements. This function returns some random parts of a vector, matrix or a data frame. The order of the elements within the object will be preserved.
Some(x, n = 6L, ...)
"Some"(x, n = 6L, ...)
"Some"(x, n = 6L, ...)
"Some"(x, n = 6L, addrownums = TRUE, ...)
n
last/first number of elements of x
.x
but generally smaller.
Some()
returns
some n
rows when n > 0
or all but the
some n
rows when n < 0
. Some.matrix()
is not exported (unlike head.matrix
). If a matrix has no row names, then Some()
will add row names of
the form "[n,]"
to the result, so that it looks similar to the
last lines of x
when printed. Setting addrownums =
FALSE
suppresses this behaviour.
I desisted from implementing interfaces for tables, ftables and functions, as this would not make much sense.
head
Some(letters)
Some(letters, n = -6L)
Some(freeny.x, n = 10L)
Some(freeny.y)
Run the code above in your browser using DataCamp Workspace