#' @title <logreturns>
#'
#' @description <Compute log-returns on a data.frame object>
#' @param df A data.frame object.
#' @export
logreturns<-function(df) {
i<-1
lrdf<-list()
for (i in 1:ncol(df)) {
diff(log(df[,i]))->lrdf[[i]]
i<-1+i
}
as.data.frame(lrdf)->lrdf
colnames(lrdf)<-colnames(df)
return=lrdf
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.