extract_dose_unit {doseminer} | R Documentation |
A function used internally in extract_from_prescription
to
parse the dosage units, such as millilitres, tablets, grams and so on.
If there are multiple units mentioned in a string, only the first is returned.
extract_dose_unit(txt)
txt |
a character vector |
A character vector the same length as txt
, containing
standardised units, or NA
if no units were found in the prescription.
A simple wrapper around str_replace_all
and
str_extract
.
Based on add_dose_unit.py
from original Python/Java algorithm.