Description Usage Arguments Value Author(s) References Examples
A factor is provided in the 1st argument. By default (i.e., "frac = NULL") equally-spaced fractions descending from 1 to 0 are returned with the number of distinct fractions equal to the number of levels of the factor (e.g., a three-level factor will have distinct values 1, 0.5, 0 returned). If there is only one level in "fact", a vector of "1" values is returned. If a numeric vector "frac" with length equal to the number of levels in "fact" is provided, then the ordered values of "frac" are substituted in for the matching values of "fact" (see the example).
1 | fact_to_frac(fact, frac = NULL)
|
fact |
a factor |
frac |
a numeric vector with length equal to the number of levels of fact. |
a numeric vector with each instance of "fact" swapped out for its matching "frac" component.
Bill Forrest <forrest@gene.com>
Bill Forrest forrest@gene.com
1 2 3 4 | animal <- factor(c('ant','bird','cat','dog','emu','cat','bird'))
animal_score <- c(1, 0.6, 0.2, 0.1, 0)
maeve:::fact_to_frac( animal )
maeve:::fact_to_frac( animal, animal_score )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.