ggpie icon indicating copy to clipboard operation
ggpie copied to clipboard

Error on "count column is missing in your data"

Open wook2014 opened this issue 11 months ago • 2 comments

Appreciate for creating such a good package. I meet up with a problem when using ggpie with summarized data. I have my data like this:

dt <- data.frame(  
  Name = c("A", "B", "C","D","E"),  
  number = c(40, 35, 30,25,20)  
)  

and this is a summarized data. According to the document mentioned in https://showteeth.github.io/ggpie/reference/ggpie.html it seemed that I can directly use number as the proportion for the pie chart by setting count_type = "count", but it is confused that how to assign the count column and after I run my code like this:

ggdonut(data = dt, group_key = "Name", count_type = "count",
                label_info = c("all"), label_type = "horizon",
                label_size = 4, label_pos = "out", label_threshold = 15)

an error occurs: Error in PrepareData(data = data, group_key = group_key, count_type = count_type, : count column is missing in your data. How to solve the problem? Should I rename the column numbertocount? And I suggest that there should be some examples with count_type = "count" in the readme document to show how to deal with wide data instead of long data.

wook2014 avatar Jul 28 '23 08:07 wook2014