pie_datacheck
checks if the provided data are suitable for creating pie charts
using the useful functions in the tastypie
package.
pie_datacheck(data, check = FALSE)
The data that you want to use for creating pie charts.
Logical, set equal to TRUE if you need a message to know if there are no problems.
If the provided data are a dataframe with only two variables (columns) with the vector of labels in the first one and the vector of values in the second one, nothing will happen. Otherwise, an error that tells you what's wrong occurs.
wrong <- c(1, 2, 3)
# Would return an Error
wrong2 <- data.frame("a" = c(1, 2, 3), "b" = c("ex", "am", "ple"))
# Would return an Error
right <- data.frame("a" = c("ex", "am", "ple"), "b" = c(1, 2, 3))
pie_datacheck(right) # No Error ==> OK!
pie_datacheck(right, check = TRUE) # Positive message
#> Your dataframe is ready for making tasty pies :)