Learn R Programming

iotables (version 0.9.4)

equation_solve: Solve a basic matrix equation

Description

Match a left-hand side (LHS) vector to a Leontief inverse by column names and compute the matrix product \(\text{LHS} \times \text{Im}\).

Usage

equation_solve(LHS = NULL, Im = NULL)

Value

A numeric 1×N matrix containing the solution \(\text{LHS} \times \text{Im}\).

Arguments

LHS

A one-row data frame (or matrix) with a key column first and numeric columns named to match the Leontief inverse.

Im

A Leontief inverse with a key column first and a square numeric block whose column names match the LHS numeric names.

Details

This helper is used by higher-level wrappers such as multiplier_create(). It assumes both inputs have a first key column, followed by numeric columns whose names define the alignment. The function multiplies the numeric row of LHS by the numeric block of Im after a basic conformity check.

Examples

Run this code
Im <- data.frame(
  a = c("row1", "row2"),
  b = c(1, 1),
  c = c(2, 0)
)
LHS <- data.frame(
  a = "lhs",
  b = 1,
  c = 0.5
)
equation_solve(Im = Im, LHS = LHS)

Run the code above in your browser using DataLab