Useful for comparing performance of investments over time.
growth_graph(tickers = NULL, ..., gains = NULL, prices = NULL,
initial = "10k", add.plot = FALSE, colors = NULL, lty = NULL,
plot.list = NULL, points.list = NULL, grid.list = NULL,
legend.list = NULL, pdf.list = NULL, bmp.list = NULL,
jpeg.list = NULL, png.list = NULL, tiff.list = NULL)
Character vector of ticker symbols that Yahoo! Finance recognizes, if you want to download data on the fly.
Arguments to pass along with tickers
to
load_gains
.
Numeric matrix with 1 column of gains for each investment (can be a vector if there is only one).
Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one).
Numeric value specifying what value to scale initial prices
to. Can also be character string ending in "k", e.g. "10k"
to graph
growth of $10k without all the 0's.
Logical value for whether to add plot data to current plot frame rather than open a new one.
Character vector of colors for each curve.
Numeric vector specifying line types for each curve.
List of arguments to pass to plot
.
List of arguments to pass to
points
.
List of arguments to pass to grid
.
List of arguments to pass to
legend
.
List of arguments to pass to pdf
.
List of arguments to pass to bmp
.
List of arguments to pass to jpeg
.
List of arguments to pass to png
.
List of arguments to pass to tiff
.
In addition to the graph, a list containing:
Numeric matrix named prices
with prices for each investment.
Numeric vector named means
with mean of gains for each
investment.
Numeric matrix named corr.matrix
with correlation matrix for
gains for each investment.
Ryan, J.A. and Ulrich, J.M. (2017) quantmod: Quantitative Financial Modelling Framework. R package version 0.4-12, https://CRAN.R-project.org/package=quantmod.
# NOT RUN {
# Plot growth of $10k in VFINX and BRK-B
fig <- growth_graph(c("VFINX", "BRK-B"))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab