Returns the first or last parts of a vector, matrix, table, data frame
or function. Since head()
and tail()
are generic
functions, they may also have been extended to other classes.
Arguments
- x
an object
- n
an integer vector of length up to
dim(x)
(or 1, for non-dimensioned objects). Alogical
is silently coerced to integer. Values specify the indices to be selected in the corresponding dimension (or along the length) of the object. A positive value ofn[i]
includes the first/lastn[i]
indices in that dimension, while a negative value excludes the last/firstabs(n[i])
, including all remaining indices.NA
or non-specified values (whenlength(n) < length(dim(x))
) select all indices in that dimension. Must contain at least one non-missing value.- ...
arguments to be passed to or from other methods.