pie_datacheck {tastypie} | R Documentation |
Check if the data is good for making tasty pies
Description
pie_datacheck
checks if the provided data are suitable for creating pie charts
using the useful functions in the tastypie
package.
Usage
pie_datacheck(data, check = FALSE)
Arguments
data |
The data that you want to use for creating pie charts. |
check |
Logical, set equal to TRUE if you need a message to know if there are no problems. |
Value
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.
Examples
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
[Package tastypie version 0.1.1 Index]