Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top