View source: R/orderedNumeric.r
orderedNumeric | R Documentation |
like as.ordered with extended formatting
orderedNumeric(
x,
prefix = "",
suffix = "",
paste.function = paste,
special.x = NULL
)
x |
a vector of numeric values |
prefix |
text string to preceed the number (like drug name) |
suffix |
text string to ome after the number (like mg) |
paste.function |
function to use when glueing together prefix, x, and suffix |
special.x |
list of length 2, with first (numeric) element being the number that will be exchanged for the 2nd element which should be a text string. |
A formatted character vector containing count and percentage of
unique values in x
.
out = expand.grid(ID = 1:5, DOSE = c(0,500,100,4000))
factor(out$DOSE)
#Levels: 0 100 500 4000 ## W H A T ???
orderedNumeric(out$DOSE)
#Levels: 0 100 500 4000 #that's better, similar to ordered(out$DOSE)
orderedNumeric(out$DOSE, special.x = list(0, "Placebo"))
#Levels: Placebo 100 500 4000
orderedNumeric(out$DOSE, prefix = "DrugName ")
orderedNumeric(out$DOSE, prefix = "DrugName", suffix = "mcg")
orderedNumeric(out$DOSE, prefix = "DrugName", suffix = "mcg", special.x = list(0, "Placebo"))
orderedNumeric(out$DOSE, prefix = "DrugName ", suffix = "mcg", special.x = list(0, "Vehicle"),
paste.function = paste0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.