# Calculating Quarterly Returns using Daily Prices in R

I am trying to compute quarterly returns with daily stock prices. However, I don't want to use the quantmod function "quarterlyReturn(x)" for each single stock but instead for the whole list of stocks...

I would be happy about any advice on how to get there.

The beginning looks like this:

 TickerList <- c("SPG", "AKR","AIV", "ARE", "AAT", "AMT", "ARI", "ABR", "ARR" )

getSymbols(Ticker, from="1950-01-01", >verbose=FALSE, auto.assign=FALSE)[,6])

all(!is.na(x))),]


Now I would like to convert my daily closing Prices to quarterly returns, in such a way that I get a new dataframe with the returns for all Stocks. I tried to use the quantmod package so that:

apply(ClosingPrices, 2, function(x),quarterlyReturn(x))


But I am just receiving error messages...

Since I am fairly new to R, I would really appreciate your help!

Many thanks

• Please provide a reproducible example and the error messages you're receiving. – Bob Jansen Mar 16 '17 at 12:57
• @BobJansen thanks for your prompt response! Next time I will include a reproducible example, thx for the hint. – Backs Mar 20 '17 at 11:49

QuarterlyReturns <- lapply(Prices, quarterlyReturn, USE.NAMES = TRUE)