extract_last | R Documentation |
Subset object using Python's negative indexing, that is, by counting indices backwards.
extract_last(x, margin_1 = NULL, margin_2 = NULL, drop = FALSE)
x |
(vector, data.frame or matrix) Object to subset. |
margin_1 |
(integer vector) Indices for the first (vertical) margin. |
margin_2 |
(integer vector) Indices for the second (horizontal) margin. |
drop |
(logical scalar) Whether to convert to a vector if there is only 1 column. Default=FALSE. |
Returns the subset of the object.
extract_last(iris, 1) # last row
extract_last(iris, , 1) # last column
extract_last(iris, 5:1, 2:1) #last 5 elements rows and last 2 columns
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.