Overwrite DOSE column into factor and ordered by value

pretty_dose(.dat, .dosecol = "DOSE", .units = "mg")

Arguments

.dat

data.frame with column `.dosecol`

.dosecol

quoted name of column containing dosing information

.units

unit to be appended to output dose column

Author

Samuel P Callisto, PhD

Examples


dose_fix <- pretty_dose(Theoph, .dosecol = "Dose", .units = "mg")
dose_fix$Dose
#>   [1] 4.02 mg 4.02 mg 4.02 mg 4.02 mg 4.02 mg 4.02 mg 4.02 mg 4.02 mg 4.02 mg
#>  [10] 4.02 mg 4.02 mg 4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg 
#>  [19] 4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg
#>  [28] 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.4 mg  4.4 mg  4.4 mg 
#>  [37] 4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  4.4 mg  5.86 mg
#>  [46] 5.86 mg 5.86 mg 5.86 mg 5.86 mg 5.86 mg 5.86 mg 5.86 mg 5.86 mg 5.86 mg
#>  [55] 5.86 mg 4 mg    4 mg    4 mg    4 mg    4 mg    4 mg    4 mg    4 mg   
#>  [64] 4 mg    4 mg    4 mg    4.95 mg 4.95 mg 4.95 mg 4.95 mg 4.95 mg 4.95 mg
#>  [73] 4.95 mg 4.95 mg 4.95 mg 4.95 mg 4.95 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg
#>  [82] 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg 4.53 mg 3.1 mg  3.1 mg 
#>  [91] 3.1 mg  3.1 mg  3.1 mg  3.1 mg  3.1 mg  3.1 mg  3.1 mg  3.1 mg  3.1 mg 
#> [100] 5.5 mg  5.5 mg  5.5 mg  5.5 mg  5.5 mg  5.5 mg  5.5 mg  5.5 mg  5.5 mg 
#> [109] 5.5 mg  5.5 mg  4.92 mg 4.92 mg 4.92 mg 4.92 mg 4.92 mg 4.92 mg 4.92 mg
#> [118] 4.92 mg 4.92 mg 4.92 mg 4.92 mg 5.3 mg  5.3 mg  5.3 mg  5.3 mg  5.3 mg 
#> [127] 5.3 mg  5.3 mg  5.3 mg  5.3 mg  5.3 mg  5.3 mg 
#> attr(,"scores")
#>  3.1 mg    4 mg 4.02 mg  4.4 mg 4.53 mg 4.92 mg 4.95 mg  5.3 mg  5.5 mg 5.86 mg 
#>    3.10    4.00    4.02    4.40    4.53    4.92    4.95    5.30    5.50    5.86 
#> 10 Levels: 3.1 mg 4 mg 4.02 mg 4.4 mg 4.53 mg 4.92 mg 4.95 mg 5.3 mg ... 5.86 mg