Skip to contents

Divides selected count columns by a total column row by row, for example excluded objects of several kinds as percentages of all objects.

Usage

PlotDataShares(data, columns, total, scale = 100, suffix = "")

Arguments

data

A data frame.

columns

Count columns.

total

Column holding the total.

scale

Multiplier (100 for percentages).

suffix

Suffix of the new columns (empty replaces the columns).

Value

data with the share columns.

Examples

PlotDataShares(data.frame(a = 1:2, b = 3:4, n = c(10, 20)), c("a", "b"), "n")
#>    a  b  n
#> 1 10 30 10
#> 2 10 20 20