powered by
Created so that a return column is added to a dataframe with prices in the long (tidy) format.
calc.ret(P, tickers = rep("ticker", length(P)), type.return = "arit")
Price vector
Ticker of symbols (usefull if working with long dataframe)
Type of price return to calculate: 'arit' (default) - aritmetic, 'log' - log returns.
A vector of returns
# NOT RUN { P <- c(1,2,3) R <- calc.ret(P) # }
Run the code above in your browser using DataLab