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

returns

Calculate returns


Description

Calculate returns

Usage

returns(x, type = "r", n = 1)

Arguments

x

numeric vector

type

'r' = x[t] / x[t-n] - 1 , 'l' = ln( x[t] / x[t-n] )

n

lookback

Value

Vector of same length as x with absent returns converted to 0 for relative and 1 for logarithmic.


QuantTools

Enhanced Quantitative Trading Modelling

v0.5.7.1
GPL-3
Authors
Stanislav Kovalevsky
Initial release

We don't support your browser anymore

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