Ops.acid: Operators on the Acid Class

View source: R/acide.R

Ops.acidR Documentation

Operators on the Acid Class

Description

Operators for the "Acid" class.

Usage

## S3 method for class 'acid'
Ops(e1, e2)

Arguments

e1

acid-object, numeric or MicrobialGrowth-object.

e2

acid-object or numeric.

Details

Operations between an acid and a numeric are the most common case. In this case, the operation is carried out on the concentration member of the acid. A new acid-object is returned with the new concentration.

Operations between acids are tolerated (but not recommended). To do this, the two acids must have the same alpha sensitivity and the same MIC, and the operation is carried out between the concentrations of the two acids. A new acid-object is returned with the new concentration.

The addition operator + can be used between MicrobialGrowth-object (left side) and an acid-object (right side). This operation symbolizes the application of the acid to the MicrobialGrowth-object. A new MicrobialGrowth-object is returned with its coefficients (and confidence intervals) modified by the acid.

Value

a new acid or MicrobialGrowth-object.

Examples

# Acids and numerics
print( Acid(1.245, 5.47) * 5 )
## acid {alpha=1.245, MIC=5.47g/L, concentration=5g/L}

print( Acid(1.245, 5.47) / 3 )
## acid {alpha=1.245, MIC=5.47g/L, concentration=0.333333333333333g/L}

print( 3 / Acid(1.245, 5.47) )
## acid {alpha=1.245, MIC=5.47g/L, concentration=3g/L}

print( 3 / Acid(1.245, 5.47, 0.5) )
## acid {alpha=1.245, MIC=5.47g/L, concentration=6g/L}

# Acids and acids
print( Acid(1.245, 5.47, 0.5) + Acid(1.245, 5.47, 2) )
## acid {alpha=1.245, MIC=5.47g/L, concentration=2.5g/L}

try({
  print( Acid(1.245, 5.47, 0.5) + Acid(1, 5.47, 2) )
  ## throws an error since `alpha` and/or `MIC` are not equal
})

# Acids and MicrobialGrowth-object
g <- MicrobialGrowth.create(N0 = c(0.13, 0.15), Nmax = 1.43, mu = c(0.05, 0.07, 0.09),
lambda = c(45, 49, 43), xlim = c(0, 100), model="gompertz")
aceticAcid <- Acid(1.245, 5.47)
{
  cat("Before :\n")
  print(g)
  cat("After:\n")
  print(g + aceticAcid)
}
## Before :
## MicrobialGrowth, model gompertz:
##     N0   Nmax     mu lambda
##   0.14   1.43   0.07  45.00
## After:
## MicrobialGrowth, model gompertz:
##          N0        Nmax          mu      lambda
##  0.14000000  1.43000000  0.06156075 51.16896670

# Also works with the `acid.specific.pair` subclass
print( Acid.SpecificPair(list(c(0.98, 5.68), c(1.51, 5.26))) )
## acid {{alpha=0.98, MIC=5.68g/L},
##       {alpha=1.51, MIC=5.26g/L}, concentration=6g/L}

MicrobialGrowth documentation built on April 12, 2025, 1:34 a.m.