Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R with xts subsetting: start date plus setting range

Tags:

r

xts

While subsetting with xts you usually set the range between two dates/times e.g.

df["T08:00/T16:59"]

or

df["2012-12-12/2012-12-12"]

I wanna set the start date and get a special period: e.g 14 days. How would you solve that problem, calculating a 2nd external variable. Or is it also possible to set the range of the subset?

Example: df["2012-12-12/14days.."]

Thanks!

like image 537
Herr Student Avatar asked May 14 '13 13:05

Herr Student


1 Answers

Try this

first(df["2012-12-12/"], "14 days")
like image 58
GSee Avatar answered Oct 20 '22 22:10

GSee