extract_dose_unit {doseminer} R Documentation

## Extract units of dose from freetext prescriptions.

### Description

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.

### Usage

extract_dose_unit(txt)


### Arguments

 txt a character vector

### Value

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.

extract_from_prescription