tags:

views:

20

answers:

1

First I read-in a csv and create an xts object.

require(quantmod)

sugar  <- as.xts(read.zoo("SUGAR.CSV", sep=",", format ="%m/%d/%Y", header=TRUE))

Then I create a new series of RSI values using TTR (loads with quantmod)

sugarRSI <- RSI(sugar)

Now I'd like to get a new series that only includes the value of the last day of each month. There is a last() function in xts, but not clear on how to deploy it efficiently.

+1  A: 

I think apply.monthly(sugarRSI, last) will do what you want.

Joshua Ulrich
Works like a charm. I need a method of keeping track of all these functions. Thanks much.
Milktrader
Reading the documentation is possible last step of desperation. *Seriously*, the zoo vignettes are excellent and almost everything carries over to `xts`.
Dirk Eddelbuettel