Summary(x, ..., na.rm = FALSE) Summary.factor(..., na.rm) Summary.ordered(..., na.rm) Summary.data.frame(..., na.rm)
x | the object used to dispatch to the appropriate Summary group method. |
... | further arguments to be passed to the group method. |
na.rm | a logical flag. If TRUE, indicates that NAs should be removed for the summary. The default is FALSE. |
Summary | A group generic function. This function generates an error if it is called directly. The functions in the group (sum, prod, max, min, range, any, and all) should be called instead. You can find the current list of functions in this group by calling getGroupMembers("Summary"). |
Summary.factor | A group S3 method for class factor. It always generates an error, because all Summary Group functions require an orderable or logical object as an argument. This method exists because it is necessary to prevent interpretation of factors as numeric objects. |
Summary.ordered | A method to allow the min, max, and range functions to work on ordered factors. Because they have an order, these functions make sense. |
Summary.data.frame | A group S3 method for the class data.frame. This is a group method for the functions of the Summary group, which all return a single numeric summary of their (numeric) arguments. This method produces an error if any of the input arguments have columns that are not numeric. |
# The Summary group of generic functions includes: # Sums & Products sum, prod # Extremes max, min, range # Logical Sum & Product any, all x <- runif(20) sum(x) max(x[1:6]) all(x) try(Summary(x)) # Error: function 'Summary' is a group generic; do not call it directlytry(sum(factor(x))) # Error: sum not meaningful for factors try(all(factor(x))) # Error: all not meaningful for factors
Size <- ordered(c("Medium", "Small"), levels=c("Small", "Medium", "Large")) range(Size)
y <- data.frame(matrix(c(2, 4, 3, 9, 21, NA, 6, 4, 9, 10, NA, 7), nrow = 3)) prod(y) sum(y, na.rm = TRUE) min(y, na.rm = TRUE) max(y, data.frame(x=1:100), na.rm = TRUE)
getGroupMembers("Summary") # list all Summary group functions