Description Usage Arguments Value Examples

This function takes values and their signs, as well as whether or not certain elements are fixed, and it forces the equation to be balanced (if possible). It does not consider any errors in the variables, as this result is simply meant to be an initial parameter in the feasability space for future optimization.

1 2 3 |

`value` |
A vector of the values in the balancing equation. |

`sign` |
A vector of negative 1's and positive 1's indicating whether an element is negative or positive in the balance (or, on the left vs. on the right side of the balance). |

`fixed` |
A vector of logicals indicating whether values are fixed or adjustable. |

`lowerBound` |
A vector of lower bounds for each element. |

`upperBound` |
A vector of upper bounds for each element. |

`standardError` |
A vector of the same length as value, used to prioritize where deltas should be allocated. Differences will first be allocated to the variable with the largest variability down to the variable with the smallest variability. Defaults to all 1's, as the relative magnitude is all that matters for the sorting. |

A vector of the same length as value, with values updated to satisfy the balance.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
## Example of positive adjusted down
faoswsBalancing:::forceBalance(value = c(100, 10, 30, 60), sign = c(1, 1, -1, -1),
fixed = c(FALSE, TRUE, TRUE, TRUE), lowerBound = c(0,0,0,0))
## Example of negative adjusted down
faoswsBalancing:::forceBalance(value = c(100, 10, 50, 80), sign = c(1, 1, -1, -1),
fixed = c(TRUE, TRUE, FALSE, TRUE), lowerBound = c(0,0,0,0))
## Example of multiple adjustments
faoswsBalancing:::forceBalance(value = c(10, 10, 30, 50), sign = c(1, 1, -1, -1),
fixed = c(TRUE, TRUE, FALSE, FALSE), lowerBound = c(0,0,0,0))
## Example of non-zero lower bound
faoswsBalancing:::forceBalance(value = c(10, 10, 30, 50), sign = c(1, 1, -1, -1),
fixed = c(TRUE, TRUE, TRUE, FALSE), lowerBound = c(0,0,0,-Inf))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.