
Last chance! 50% off unlimited learning
Sale ends in
returns(x, ...)## S3 method for class 'ANY':
returns(x, method = c("continuous", "discrete",
"compound", "simple"), percentage = FALSE, ...)
## S3 method for class 'timeSeries':
returns(x, method = c("continuous", "discrete",
"compound", "simple"), percentage = FALSE, na.rm = TRUE,
trim = TRUE, ...)
getReturns(...)
returnSeries(...)
FALSE
, if TRUE
the
series will be expressed in percentage changes.timeSeries
.timeSeries
.## data -
# Microsoft Data:
setRmetricsOptions(myFinCenter = "GMT")
MSFT = as.timeSeries(data(msft.dat))[1:10, 1:4]
head(MSFT)
## returnSeries -
# Continuous Returns:
returns(MSFT)
# Discrete Returns:
returns(MSFT, type = "discrete")
# Don't trim:
returns(MSFT, trim = FALSE)
# Use Percentage Values:
returns(MSFT, percentage = TRUE, trim = FALSE)
Run the code above in your browser using DataLab