describe | R Documentation |
These functions provide a summary description of the contents of different types of R objects. Unique elements are shown and sorted so that the minimum and maximum values are visible. For integer values, ranges are shown. For data frames, the total number of NA or missing values are also shown, along with the contents of each variable field.
describe(x, ...)
## S3 method for class ''NULL''
describe(x, ...)
## S3 method for class 'logical'
describe(x, ...)
## S3 method for class 'numeric'
describe(x, digits = 3, max = 10, sep = "-", ...)
## S3 method for class 'character'
describe(x, max = 10, sep = "', '", ...)
## S3 method for class 'factor'
describe(x, max = 10, sep = ", ", ...)
## S3 method for class 'data.frame'
describe(x, indent = 3, drop = FALSE, ...)
x |
Data frame. |
... |
Other arguments (not used). |
digits |
Number of significant digits to display for real numbers (default = 3). |
max |
Maximum number of different elements to display (default = 10). |
sep |
Character string specifying the separator to be used in concatenating unique values. |
indent |
Number of spaces to indent field variables when displaying a data frame (default = 3). |
drop |
Logical value specifying whether to ignore empty variables in the output. |
describe(`NULL`)
: NULL method.
describe(logical)
: Summary contents of a logical vector.
describe(numeric)
: Summary contents of a numeric vector.
describe(character)
: Summary contents of a character vector.
describe(factor)
: Summary contents of a factor.
describe(data.frame)
: Summary contents of a data frame.
# Integer examples:
describe(1:10)
describe(seq(2, 10, by = 2))
describe(seq(2, 40, by = 2))
# Decimal numeric examples:
describe(rnorm(10))
describe(rnorm(20))
# Character string examples:
describe(LETTERS[1:5])
describe(LETTERS)
# Create data frame
x <- data.frame(categories = LETTERS[1:5],
n = rpois(5, lambda=1),
values = rnorm(5))
describe(x)
# Bigger example:
x <- data.frame(categories = factor(sample(LETTERS[1:5], 25, replace = TRUE),
levels = LETTERS[1:5]),
n = rpois(25, lambda = 10),
values = sample(c(rnorm(20), rep(NA, 5))),
result = runif(25) > 0.3,
missing = NA,
stringsAsFactors = FALSE)
describe(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.