There are many ways to do it:
tail()
x[length()]
dplyr::last()
x[end()[1]]
mylast()
rev()[1]
as some of them are either C++ function implemented through Rcpp or used by installing a package, I recommend you to use tail() as it's a built-in function and works with data frames too.
tail(vector, n=1)
Hope this helps. Cheers...!!