Convert factor to a factor label
factor2label( x, valuesL = NULL, types = c("count", "none"), aggFun = mean, digits = 3, big.mark = ",", itemName = "items", ... )
x | factor vector |
---|---|
valuesL | optional list of numeric values, where each vector
has the same length as |
types | character value indicating the summary to use for
the input factor |
aggFun | summary function used for each vector of numeric values
in |
digits, big.mark | arguments passed to |
itemName | character vector indicating the name to associate to counts. |
... | additional arguments are ignored. |
factor vector with the same length as input x
but
where the levels also include summary information, such
as the count of each factor level.
This function is intended to take a vector of factor levels and convert to labels using summary statistics. For example by default it will add the number of items for each factor level.
This function is intended to help create useful ordered factor labels that can be used in a ggplot2 visualization.
Other jam plot functions:
bgaPlotly3d()
,
gene2gg()
,
grl2df()
,
jitter_norm()
,
plotSashimi()
,
prepareSashimi()
,
stackJunctions()
#> [1] "a (2 items)" "b (4 items)" "c (3 items)" "d (2 items)" "e (1 items)"factor2label(x);#> a a b b b b #> a (2 items) a (2 items) b (4 items) b (4 items) b (4 items) b (4 items) #> c c c d d e #> c (3 items) c (3 items) c (3 items) d (2 items) d (2 items) e (1 items) #> Levels: a (2 items) b (4 items) c (3 items) d (2 items) e (1 items)