Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

table.CalendarReturns

Monthly and Calendar year Return table


Description

Returns a table of returns formatted with years in rows, months in columns, and a total column in the last column. For additional columns in R, annual returns will be appended as columns.

Usage

table.CalendarReturns(R, digits = 1, as.perc = TRUE, geometric = TRUE)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

digits

number of digits to round results to for presentation

as.perc

TRUE/FALSE if TRUE, multiply simple returns by 100 to get %

geometric

utilize geometric chaining (TRUE) or simple/arithmetic chaining (FALSE) to aggregate returns, default TRUE

Note

This function assumes monthly returns and does not currently have handling for other scales.

This function defaults to the first column as the monthly returns to be formatted.

Author(s)

Peter Carl

Examples

data(managers)
t(table.CalendarReturns(managers[,c(1,7,8)]))

# prettify with format.df in hmisc package
require("Hmisc")
result = t(table.CalendarReturns(managers[,c(1,8)]))

textplot(format.df(result, na.blank=TRUE, numeric.dollar=FALSE, 
         cdec=rep(1,dim(result)[2])), rmar = 0.8, cmar = 1,  
         max.cex=.9, halign = "center", valign = "top", 
         row.valign="center", wrap.rownames=20, wrap.colnames=10, 
         col.rownames=c( rep("darkgray",12), "black", "blue"), 
         mar = c(0,0,3,0)+0.1)
         
title(main="Calendar Returns")

PerformanceAnalytics

Econometric Tools for Performance and Risk Analysis

v2.0.4
GPL-2 | GPL-3
Authors
Brian G. Peterson [cre, aut, cph], Peter Carl [aut, cph], Kris Boudt [ctb, cph], Ross Bennett [ctb], Joshua Ulrich [ctb], Eric Zivot [ctb], Dries Cornilly [ctb], Eric Hung [ctb], Matthieu Lestel [ctb], Kyle Balkissoon [ctb], Diethelm Wuertz [ctb], Anthony Alexander Christidis [ctb], R. Douglas Martin [ctb], Zeheng 'Zenith' Zhou [ctb], Justin M. Shea [ctb]
Initial release
2020-02-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.