whoPays: Splits a vector in 2 shorter ones depending on the amount a...

Description Usage Arguments Value Examples

View source: R/whoPays.R

Description

This is an internal function. It should not be called directly by the user.

Usage

1
whoPays(pos, neg)

Arguments

pos

Numeric vector containing the amount of money some people in the group have spend in excess and should be reimbursed of. Idealy, the vector should have a name for each value.

neg

Numeric vector containing the amount of money some people in the group should reimburse to balance the spendings. Idealy, the vector should have a name for each value.

Value

A list of 2 numerical vectors. Remb contains the values that a set of people need to spend to reimburse the first person in the pos vector. Reste contains the value that each debtor has still to spend to reimburse the remaining people in the pos vector.

Examples

1
2
3
4
5
pos <- c(125, 346)
names(pos) <- c("John", "Gail")
neg <- c(28, 312, 41, 90)
names(neg) <- c("Mike", "Lenny", "Christine", "Sally")
whoPays(pos,neg)

besibo/compteR documentation built on Dec. 31, 2019, 5:59 p.m.