Description Usage Arguments Value Author(s) References See Also Examples
Selects the last n
elements of an object. The default method of the
convenience wrapper last
.
1 2 |
x |
|
n |
|
keep |
|
strict |
|
Subset of x
. Exact value depends on the class of x
.
Janko Thyson janko.thyson@gmail.com
http://github.com/rappster/selectr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | ##------------------------------------------------------------------------------
## Vector //
##------------------------------------------------------------------------------
x <- letters
last(x)
last(x, 3)
last(x, 3, keep = TRUE)
last(x, 25)
## Conditions //
last(x, 30)
last(x, 30, strict = 1)
last(x, 30, strict = 2)
try(last(x, 30, strict = 3))
##------------------------------------------------------------------------------
## List //
##------------------------------------------------------------------------------
x <- as.list(letters)
last(x)
last(x, 3)
res <- last(x, 3, keep = TRUE)
attributes(res)
## Conditions //
last(x, 30)
last(x, 30, strict = 1)
last(x, 30, strict = 2)
try(last(x, 30, strict = 3))
##------------------------------------------------------------------------------
## Data frame //
##------------------------------------------------------------------------------
x <- data.frame(a= 1:5, b = letters[1:5], stringsAsFactors = FALSE)
## Rows:
last(x)
last(x, 3)
res <- last(x, 3, keep = TRUE)
attributes(res)
## Columns:
last(x, margin = 2)
last(x, 2, margin = 2)
last(x, 3, margin = 2)
last(x, margin = 2, drop = TRUE)
last(x, 2, margin = 2, drop = TRUE)
## Conditions:
first(x, 10)
first(x, 10, strict = 1)
first(x, 10, strict = 2)
try(first(x, 10, strict = 3))
first(x, 3, margin = 2)
first(x, 3, margin = 2, strict = 1)
first(x, 3, margin = 2, strict = 2)
try(first(x, 3, margin = 2, strict = 3))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.