문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top