to.limits.rcdk {RMassBank} | R Documentation

## Convert formula to Rcdk limits

### Description

Converts a molecular formula e.g. C15H20 into an upper limit appropriate for use with Rcdk's `generate.formula` function's `element` argument.

### Usage

    to.limits.rcdk(formula)

### Arguments

`formula` | A molecular formula in string or list representation (`"C6H6"` or `list(C=6,H=6)`).

### Details

This helper function is used to make the upper limits for `generate.formula` when finding subformulas to match to a MS2 fragment peak.

### Value

An array in the form `c( c("C", "0", "12"), c("H", "0", "12"))` (for input of "C12H12").

### Author(s)

Michael Stravs

### See Also

`generate.formula`, `add.formula`

### Examples

    #
    to.limits.rcdk("C6H6")
    to.limits.rcdk(add.formula("C6H12O6", "H"))

[Package RMassBank version 2.14.1 Index]