-1

suppose I have daily time series data under variable name "prices", but im only interested in the past 100 days. How would i extract the last 100 elements from this variable?

Something equivalent to python's prices[-100:] but for R?

stavro
  • 103
  • 1
  • 5

1 Answers1

2

If it's a vector:

tail(prices, 100)
neilfws
  • 32,751
  • 5
  • 50
  • 63