[R-SIG-Finance] Performance Analytics table.AnnualizedReturns

varcovar varcovar at live.com
Fri Sep 7 10:35:22 CEST 2012


Hi Nick, 

I don't think there's any table for that specific need. However, here's how
I would do it: 

library(PerformanceAnalytics)
data(managers)
R <- managers[, 2]
years <- as.character(unique(lubridate:::year(index(R))))
# Return a list whose elements are years and contain table
ll <- plyr:::llply(years, function(x) {
    ret <- table.AnnualizedReturns(R[x])
    colnames(ret) <- x
    ret
})
# Return a table
df <- unlist(ll)
dim(df) <- c(3, length(years))
colnames(df) <- years
rownames(df) <- c("Annualized Return", "Annualized Volatility", "Sharpe
Ratio")

Cheers! 

Markus D.



--
View this message in context: http://r.789695.n4.nabble.com/Performance-Analytics-table-AnnualizedReturns-tp4642468p4642485.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list