# download daily US/EU exchange rate from
# the FRED system
getSymbols("DEXUSEU",src="FRED")
getSymbols("QQQQ",src="yahoo")
# look at the data : )
DEXUSEU # univariate time series
QQQQ # OHLC already
# now it's a yearly OHLC
dex1 <- to.yearly(DEXUSEU)
# first monthly, then to yearly
dex2 <- to.yearly(to.monthly(DEXUSEU))
identical(dex1,dex2) # it's the same!
q1 <- to.yearly(QQQQ)
q2 <- to.yearly(to.monthly(QQQQ))
# these don't match - sometimes dates
# are off depending on when cutoffs
# occur - so BE CAREFUL when converting
# a converted object!
identical(q1,q2)
Run the code above in your browser using DataLab