Skip to contents

Calculate ratios between all element frequency combinations.

Usage

elementRatios(element_frequencies, elements = c("C", "H", "N", "O", "P", "S"))

Arguments

element_frequencies

a tibble containing element frequencies as returned by elementFrequencies()

elements

a character vector of elements for which to calculate ratios

Value

A tibble containing element frequency ratios for all element combinations. NA is returned where the element ratios are not relevant for a given molecular formula.

Examples

elementFrequencies(c('H2O','C12H22O11')) %>% 
  elementRatios()
#> # A tibble: 2 × 7
#>   MF         `C/H` `C/O` `H/C` `H/O`  `O/C` `O/H`
#>   <chr>      <dbl> <dbl> <dbl> <dbl>  <dbl> <dbl>
#> 1 H2O       NA     NA    NA        2 NA       0.5
#> 2 C12H22O11  0.545  1.09  1.83     2  0.917   0.5