[R] RES: Doubit about ts() functions
Filipe Leme Botelho
filipe.botelho at vpar.com.br
Tue Jun 21 21:03:09 CEST 2011
Flávio, first install package 'xts'. Then with a matrix with rownames as dates like:
> testing
[,1]
2011-05-12 177.05
2011-05-13 182.85
2011-05-16 182.20
2011-05-17 181.90
2011-05-18 180.50
2011-05-19 184.95
2011-05-20 181.75
2011-05-23 180.85
2011-05-24 182.75
2011-05-25 186.80
2011-05-26 185.35
2011-05-27 185.35
2011-05-31 182.50
2011-06-01 182.00
# Map the endpoints using xts.
> week_ends <- endpoints(testing, 'weeks')
> week_ends
[1] 0 2 7 12 14
> testing[week_ends,]
2011-05-13 2011-05-20 2011-05-27 2011-06-01
182.85 181.75 185.35 182.00
This works for 'years' and 'months' as well, so it´s quite useful.
HTH,
Filipe Botelho
-----Mensagem original-----
De: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Em nome de Flávio Fagundes
Enviada em: terça-feira, 21 de junho de 2011 15:37
Para: r-help
Assunto: [R] Doubit about ts() functions
Hi everyone
Please, I need one more help you
I have some data that need to make a forecast.
I´m using the command: Yst<-print(ts<-ts(Y,start=c(1,5),freq=7),calendar=T)
to create the dayly time series by the dataframe Y.
My data Y means: Y=measure dayly , start at 01/jul/2010 (thursday), for this reason that I use c(1,5).
I need to create the time series aggregate by weakly (and not dayly as shown above), but if I use the command freq=7 is dayly, freq=12 is month, freq=12 is year, freq=5 the Arima command don´t recognize the períod, if I use
freq=4 is trimestral.
I can to aggregate into excel and after import to R, but anyway, I will need to create the time series (weekly) and again I back to start point.
How can I transform my data- frame Y in time series aggregate by weakly where the command arima recognize the period?
Tks
Flávio
[[alternative HTML version deleted]]
"This message and its attachments may contain confidential and/or privileged information. If you are not the addressee, please, advise the sender immediately by replying to the e-mail and delete this message."
"Este mensaje y sus anexos pueden contener información confidencial o privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un mensaje al remitente."
"Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação ao remetente e exclusão da mensagem."
More information about the R-help
mailing list