Description Usage Arguments Details Value
Given items data, with columns 'hash_str', 'title', 'prediction', 'grams', 'ounces', 'pounds', 'milligrams', 'pills', 'quantity', consolidate these into 'dosage' and 'unit', where dosage is e.g. "100mg", and unit is some number, e.g. 30 for 30 pills, or 10 for "10 credit cards."
1 | consolidateCols(itemsTuple)
|
itemsTuple |
name of dataframe with items data, described above |
For dosage, we first choose the first available value of grams, ounces, pounds and milligrams. Then we process the raw text (change comma to ., change one/quarter/full/half, and fractions into numbers), pasting with the unit to get outputs like "100mg." Note that this process is not foolproof and some dosages will inevitably be missed.
Similarly for units we look at pills first, and if this is unavailable we use quantity (note that quantity is only not NA if pills and all dosage cols are NA). This is converted to a numeric variable and output.
dataframe with columns 'hash_str', 'title', 'prediction', 'dosage', 'unit'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.