How do i take the last n elements from a vector in R? -


suppose have daily time series data under variable name "prices", im interested in past 100 days. how extract last 100 elements variable?

something equivalent python's prices[-100:] r?

if it's vector:

tail(prices, 100) 

Comments