how to print last value of vector in r code example Example: r last value of vector x[length(x)] # fastest tail(x, 1) # easiest