Description Usage Arguments Value Note See Also Examples
Calculates log-returns between values with specified lag.
| 1 | logReturns(x, lag = 1, na_padding = TRUE, base = exp(1))
 | 
| x | A numeric vector containing the values for which returns are calculated. | 
| lag | Integer indicating which lag to use (default: 1). | 
| na_padding | Flag whether to pad truncated values with NA's (default: TRUE). | 
| base | A positive number giving the base with respect to which the logarithm is
computed. Default is e, i.e.  | 
Numeric vector with log-returns of specified lag.
Parameter na_padding behaves slightly different from diff
in order to achieve consistency with lead and lag.
| 1 2 3 | logReturns(1:10)
logReturns(c(1, 2, 4, 8, 16, 32), base = 2)
logReturns(c(1, 2, 4, 8, 16, 32), base = 2, na_padding = FALSE)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.