Skip to contents

Adds scale * (numerator + pseudocount) / (denominator + pseudocount), optionally on a logarithmic scale. Zero numerators give -Inf on a log scale; builders such as PlotBandProfiles() draw them at a floor.

Usage

PlotDataRatio(
  data,
  numerator,
  denominator,
  pseudocount = 0,
  log_base = NULL,
  scale = 1,
  into = "ratio"
)

Arguments

data

A data frame.

numerator, denominator

Numeric columns.

pseudocount

Added to both columns.

log_base

Optional logarithm base.

scale

Multiplier applied before the logarithm.

into

Name of the new column.

Value

data with the ratio column.

Examples

PlotDataRatio(data.frame(a = c(1, 0, 4), b = 2), "a", "b", log_base = 2)
#>   a b ratio
#> 1 1 2    -1
#> 2 0 2  -Inf
#> 3 4 2     1