Construct the data.frame
for the make.donut.plot()
function.
The raw data.frame
or a summarised data.frame
is acceptable and will be
converted into the needed data for the construction of a donut plot.
Usage
make.donut.data(
data,
category,
category.order = "count",
category.count = NULL,
facetBy = NULL,
layerBy = NULL,
layer.order = "descend",
layer.alpha.min = 0.75,
levels.rev = FALSE,
r.inner = 4,
r.outer = 6
)
Arguments
- data
tibble
(ordata.frame
) with the column of interest. NOTE: Do NOT use counted data.- category
string with column of interest containing the categories to comprise the donut (aka ring). Only provide ONE column name.
- category.order
string indicating if you want the data to be ordered by
"count"
in decreasing order or by"category"
in alphabetical order; default:"count"
.- category.count
string with the column containing "counts" for each "category." This parameter is required when the count (or total) for each row was pre-calculated and allows for the creation of donut data when raw data is not available and one only has the summarised values.
- facetBy
string indicating the column to group data by; for when you want to facet your donut plots via
ggplot2::facet_wrap()
; seemake.donut.plot()
.- layerBy
string indicating the column to group data by; for when you want to add layers your donut plots; see
make.donut.plot()
.- layer.order
string indicating the order of the layers. There are four options:
ascend
where the inner ring (donut) has the smallest value and the outer donut has the greatest valuedescend
where the inner donut as the largest value and the outer ring has the smallest valuealphabetical
where the rings are ordered alphabetically starting from the inner ringuser defined
where the user provides the order of the donuts starting from inner ring. Only layers included in the vector (e.g.,c("4", "r", "f")
) are included in the resulting data.
For
alphabetical
,ascend
, anddescend
only the first two characters are needed.- layer.alpha.min
value indicating the minimum alpha value; default:
0.75
- levels.rev
logical indicating if the order of the categories should be reversed.
- r.inner
numeric value defining the inner radius of the donut; default:
4
- r.outer
numeric value defining the outer radius of the donut; default:
6
Author
Emilio Xavier Esposito emilio.esposito@gmail.com (https://github.com/emilioxavier)