I'm looking for the most efficent way (i.e. the lesser keys pressed) to indexing the last element of an array.
Then something like
a <- c(1,2,3)
n <- length(a)
b <- a[n]
should not be used, I would like to use just a single command.
In the example above I could use
b <- a[length(a)]
but I wonder if something shorter does exist.
Let I want to select a part of an array, like
a <- seq(from = 1, to = 10, by = 1)
b <- a[3:length(a)]
Is there a shorter way to do it?