addterm: Add a Single Row to a Lookup Table

View source: R/importexport.R

addtermR Documentation

Add a Single Row to a Lookup Table

Description

Returns an updated version of one of the dictionaries / lookup tables with an additional row.

Usage

addterm(x, ...)
## S3 method for class 'drugdose_singlewords'
addterm(x, words = "", replacement = "")
## S3 method for class 'drugdose_multiwords'
addterm(x, order = NA, words = "", replacement = "",
    comment = "")
## S3 method for class 'drugdose_patterns'
addterm(x, order = NA, words = "", qty = NA, units = "",
    freq = NA, tot = NA, priority = 0, max = "exact", time = NA,
    change = "nochange", choice = "nochoice", doubledose = FALSE,
    duration = NA, category = "", comment = "")
## S3 method for class 'drugdose_lookups'
addterm(x, textid = 0, text = "", qty = NA, units = "",
    freq = NA, tot = NA, max = "exact", time = NA,
    change = "nochange", choice = "nochoice", duration = NA,
    daily_dose)

Arguments

x

An R object of class drugdose_singlewords, drugdose_multiwords, drugdose_patterns or drugdose_lookups.

textid

Identifier for lookup (numeric).

words

Single word for singlewords, regular expression for multiwords and patterns.

text

Complete dosage text for lookup table.

replacement

Replacement for words.

order

A number to denote the order in which pattern matching rules are applied (for patterns and multiwords dictionaries).

qty

Quantity per dose.

units

Dose units.

freq

Frequency of dosing per time period.

tot

Total dose per time period.

priority

Whether this pattern can override other patterns (higher number = greater priority)

max

"max", "average" or "exact" (default).

time

Time period in days.

change

"nochange", "first" (there is a change of dose, and the extracted daily dose refers to the dose for the first period of the prescrription), "second" (second dose is reported) or "combined" (multiple dose lines with defined durations are combined). "nochange" is default.

choice

"nochoice", "choice" or "asneeded". "nochoice" is default.

doubledose

TRUE if the pattern implies that the dose should be doubled because it is used in both eyes, ears or nostrils.

duration

Prescription duration

daily_dose

Total number of dose units per day.

category

Category of pattern, for reference only, not used in analysis.

comment

Comment on the multiwords or patterns entry.

...

Generic arguments for addterm method.

Value

Updated version of the object x, containing the extra row

Author(s)

Anoop Shah

References

Shah AD, Martinez C. An algorithm to derive a numerical daily dose from unstructured text dosage instructions. Pharmacoepidemiol Drug Saf 2006; 15(3): 161-166. doi: 10.1002/pds.1151 http://onlinelibrary.wiley.com/doi/10.1002/pds.1151/

See Also

as.drugdose_singlewords, as.drugdose_multiwords, as.drugdose_patterns, as.drugdose_lookups, export

Examples

data(singlewords)
singlewords <- as.drugdose_singlewords(singlewords)

mydict <- addterm(singlewords, words = 'tabletes', replacement = 'tab')

CALIBERdrugdose documentation built on July 4, 2024, 3:01 p.m.