#' Create the change in final demand vector
#'
#' This function takes simulated changes in demand and puts them into a vector of final demand changes
#' appropriate for the IO table being used for the analysis.
#'
#' @param iotable the IO table being used by the analysis, to establish the length of the final demand vector and the positions of
#' on-trade and off-trade alcohol, and tobacco.
#'
#' @param alcohol.vector the vector of changes in alcohol consumption established by the policy simulation functions.
#' @param tobacco.vector the vector of changes in tobacco consumption established by the policy simulation functions (currently a scalar).
#'
#' @return a table of output effects (in levels and percentages) and associated Type I and II multipliers.
#'
#' @export
final_demand_changes <- function(iotable = c("example"),
alcohol.vector = NULL,
tobacco.vector = NULL) {
##### Code for a vector to use with the example IO table #####
if (iotable == "example") {
change.vector <- rep(0,3)
### alcohol ###
if (is.null(alcohol.vector) == FALSE) {
change.vector[1] <- alcohol.vector[1]
change.vector[2] <- alcohol.vector[2]
}
### tobacco ###
if (is.null(tobacco.vector) == FALSE) {
change.vector[3] <- tobacco.vector
}
}
##### Code for a vector to use with the FAI IO table #####
############# Return the change vector
return(change.vector)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.