describe | R Documentation |
Function to return a one-row dataframe with descriptives for a target vector
Mirrors describe_df
, but for standalone vectors.
describe(x, digits = NULL)
x |
Vector. |
digits |
Optional argument to round output to a specified number of digits. |
Will coerce using as.vector()
to handle factors or labelled vectors.
Count in the distinct
column excludes values of NA
.
describe(mtcars$mpg)
describe(mtcars$mpg, 2)
describe(mice::boys$hc)
# handling of a factor
describe(mice::boys$gen)
# NAs are excluded from the count of 'distinct'
describe(c(0, 1, 1, 0, NA))
# a common use case, distinct from describe_df()
describe(mtcars$hp / mtcars$wt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.