[R-SIG-Finance] [R-sig-finance] xts and to.weekly function

Josh Ulrich josh.m.ulrich at gmail.com
Mon Apr 20 15:56:34 CEST 2009


Does this provide what you want?

require(quantmod)
getSymbols("USD/EUR",src="oanda",from="2009-01-01")

# endpoints(..., on='weeks') returns Sundays
fri <- endpoints(USDEUR, on='weeks')-2

# replace first observation with zero, and remove last observation
# see ?endpoints
fri[1] <- 0;  fri <- head(fri,-1)

# data series of only Fridays
USDEUR[fri]

HTH,
Josh
--
http://quantemplation.blogspot.com
http://www.fosstrading.com



On Mon, Apr 20, 2009 at 4:53 AM, kafkaz <kafka at centras.lt> wrote:
>
> Hello,
> I have a xts object, which contains daily data. The object contains Saturday
> quotes and the function "to.weekly" returns closing prices of Saturday. How
> can I get Friday's closing price through xts functionality? I was looking at
> the "endpoints" function, but it seems, that it is impossible through that
> function.
> Thank you.
> --
> View this message in context: http://www.nabble.com/xts-and-to.weekly-function-tp23133625p23133625.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



More information about the R-SIG-Finance mailing list