Description Usage Arguments Value Note Examples
Compute financial returns from prices or indexes.
1 2 3 4 5 6 7 8 9 10 11 12 13  returns(x, ...)
returns0(x, ...)
## S4 method for signature 'ANY'
returns(x, method = c("continuous", "discrete",
"compound", "simple"), percentage = FALSE, ...)
## S4 method for signature 'timeSeries'
returns(x, method = c("continuous", "discrete",
"compound", "simple"), percentage = FALSE, na.rm = TRUE,
trim = TRUE, ...)
getReturns(...)
returnSeries(...)

x 
an object of class 
percentage 
a logical value. By default 
method 
a character string. Which method should be used to compute the returns, "continuous", "discrete", or "compound", "simple". The second pair of methods is a synonyme for the first two methods. 
na.rm 
a logical value. Should NAs be removed? By Default 
trim 
a logical value. Should the time series be trimmed? By Default

... 
arguments to be passed. 
all functions return an object of class timeSeries
.
returns0
returns am untrimmed series with the first
row of returns set to zero(s).
The functions returnSeries
, getReturns
,
are synonymes for the function returns
. We do
not recommend to use these functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  ## Load Microsoft Data 
setRmetricsOptions(myFinCenter = "GMT")
data(MSFT)
X = MSFT[1:10, 1:4]
X
## Continuous Returns 
returns(X)
returns0(X)
## Discrete Returns:
returns(X, method = "discrete")
## Don't trim:
returns(X, trim = FALSE)
## Use Percentage Values:
returns(X, percentage = TRUE, trim = FALSE)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs in the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.