#' Compute Index
#'
#' Function to compute an Index given the prices and weights
#'
#' @param prices component's prices, in currency (€, $, ...) per share
#' @param weights component's weights, in number of shares
#'
#' @return the index value given the prices and weights.
#' @export
#'
#' @examples
#' myIndex <- compute_index(c(1.50, 2.22, 3.88, 10.66),
#' c(654, 543, 123, 10))
#'
compute_index <- function(prices, weights){
index <- prices %*% weights
invisible(index)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.