HT index RSI value at end of each month in an xts time series object

StackOverflow https://stackoverflow.com/questions/3548600

  •  30-09-2019
  •  | 
  •  

Pergunta

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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top