r-hyperspec / hyperSpec

hyperSpec: Tools for Spectroscopy (R package)
https://r-hyperspec.github.io/hyperSpec/
GNU General Public License v3.0
12 stars 3 forks source link

Create function `wl_create_label_from_units()` #60

Closed GegznaV closed 2 years ago

GegznaV commented 3 years ago

Basing on the lines from R/wl_convert_units.R (see this comment ):

  x@label$.wavelength <-
    switch(.wl_fix_unit_name(to),
       nm    = expression("Wavelength, nm"),
      invcm = expression(tilde(nu) / cm^-1),
      ev    = expression("Energy / eV"),
      freq  = expression(nu / THz),
      raman = expression(Raman ~ shift / cm^-1),
      to
    )

A separate function should be created. The function's signature could be wl_create_label_by_units(wl_units) wl_create_label_from_units(wl_units) and it should return an expression with label for @label$.wavelength.

If this is implemented, labels in


Tasks:

cbeleites commented 3 years ago

is by the correct preposition? @bryanhanson ?

bryanhanson commented 3 years ago

"by" is OK, but "from" is better.