inst/app-visualize/helper/highpie.R

highpie <- function(data, column) {
  
  da <- data %>%
    select_(column) %>%
    pull(1) %>%
    as.factor() 
  
  freq <- da %>%
    table() %>%
    as.vector()
  
  labels <- da %>%
    levels()
  
  highchart() %>%
    hc_chart(type = 'pie') %>%
    hc_add_series_labels_values(labels, freq, 
                                name = "Pie", colorByPoint = TRUE, 
                                type = "pie")
  
}

# highpie(mtcars, 'cyl')

Try the xplorerr package in your browser

Any scripts or data that you put into this service are public.

xplorerr documentation built on Feb. 28, 2019, 5:05 p.m.