pie_chart {visachartR} | R Documentation |
pie_chart
Description
R wrapper for @visa/pie-chart via htmlwidgets.
Here is an example of pie-chart in action:
Usage
pie_chart(
data,
ordinalAccessor,
valueAccessor,
mainTitle = "",
subTitle = "",
accessibility = list(),
props = list(),
...
)
Arguments
data |
required to be a valid, R data frame. Data used to create chart, an array of objects which includes keys that map to chart accessors. |
ordinalAccessor |
String. Key used to determine chart's categorical property. |
valueAccessor |
String. Key used to determine chart's numeric property. |
mainTitle |
String. The dynamic tag of title for the map (or you can create your own separately). See |
subTitle |
String. The dynamic tag for a sub title for the map (or you can create your own separately). See |
accessibility |
List(). Manages messages and settings for chart accessibility, see object definition |
props |
List(). A valid R list with additional property configurations, see all props for @visa/pie-chart |
... |
All other props passed into the function will be passed through to the chart, see all props for @visa/pie-chart. |
Details
To see all available options for the chart properties/API see @visa/pie-chart.
Value
a visaChart htmlwidget object for plotting a pie chart
Examples
library(dplyr)
data.frame (HairEyeColor) %>%
filter(Hair=="Blond", Sex=="Male") %>%
mutate(blueEyes = if_else(Eye=="Blue", "Blue","Other")) %>%
group_by(blueEyes, Hair, Sex) %>%
summarise(FreqSum=sum(Freq), n=n()) %>%
pie_chart(
"blueEyes",
"FreqSum",
mainTitle="How many males with Blonde hair have Blue eyes?",
sortOrder="desc"
)