Selects or drops the last element or the last n elements of a
vector or the last n rows or ncol columns of a matrix
Usage
last(data, n = NULL, ncol=NULL, drop=is.matrix(data))
Value
The selected elements of the vector or matrix or data.frame
Arguments
data
vector or matrix or data.frame from which to select or drop
n
if >0, last selects the last n elements (rows) form
the result.
if <0, the last abs(n) elements (rows) are dropped, and the first
length(data)-abs(n) ones from the result
ncol
if data is a matrix or data.frame, the last
ncol columns are selected (if ncol is positive)
or dropped (if negative).
drop
if only one row or column of a matrix (or one column of a
data.frame) is selected or left over, should the result be a vector
or a row or column matrix (or one variable data.frame)