Learn R Programming

stocks (version 1.1.4)

prices_gains: Convert Prices to Gains

Description

Calculates gains based on vector or matrix of prices.

Usage

prices_gains(prices)

Arguments

prices

Numeric matrix with 1 column of prices for each investment (can be a vector if there is only one).

Value

Numeric vector or matrix.

Examples

Run this code
# NOT RUN {
# Load 2017 prices for Netflix and Amazon, and calculate growth of $10k
prices <- load_prices(c("NFLX", "AMZN"), initial = 1000)

# Calculate gains
gains <- prices_gains(prices)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab