HT index RSI value at end of each month in an xts time series object
문제
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.
해결책
I think apply.monthly(sugarRSI, last)
will do what you want.
제휴하지 않습니다 StackOverflow