This function provides a number of descriptives about your data, similar to what SPSS's DESCRIPTIVES (often called with DESCR) does.
descr( x, digits = 4, errorOnFactor = FALSE, include = c("central tendency", "spread", "range", "distribution shape", "sample size"), maxModes = 1, t = FALSE, conf.level = 0.95, quantileType = 2 ) # S3 method for default descr( x, digits = 4, errorOnFactor = FALSE, include = c("central tendency", "spread", "range", "distribution shape", "sample size"), maxModes = 1, t = FALSE, conf.level = 0.95, quantileType = 2 ) # S3 method for descr print( x, digits = attr(x, "digits"), t = attr(x, "transpose"), row.names = FALSE, ... ) # S3 method for descr pander(x, headerPrefix = "", headerStyle = "**", ...) # S3 method for descr as.data.frame(x, row.names = NULL, optional = FALSE, ...) # S3 method for data.frame descr(x, ...)
x | The vector for which to return descriptives. |
---|---|
digits | The number of digits to round the results to when showing them. |
errorOnFactor | Whether to show an error when the vector is a factor, or just show the frequencies instead. |
include | Which elements to include when showing the results. |
maxModes | Maximum number of modes to display: displays "multi" if more than this number of modes if found. |
t | Whether to transpose the dataframes when printing them to the screen (this is easier for users relying on screen readers). |
conf.level | Confidence of confidence interval around the mean in the central tendency measures. |
quantileType | The type of quantiles to be used to compute the
interquartile range (IQR). See |
row.names | Whether to show row names ( |
... | Additional arguments are passed to the default |
headerPrefix | The prefix for the heading; can be used to insert
hashes ( |
headerStyle | A string to insert before and after the heading (to make stuff bold or italic in Markdown). |
optional | Provided for compatibility with the default |
A list of dataframes with the requested values.
Note that R (of course) has many similar functions, such as
summary
, psych::describe()
in the excellent
psych::psych package.
The Hartigans' Dip Test may be unfamiliar to users; it is a measure of uni-
vs. multidimensionality, computed by diptest::dip.test()
from the
dip.test
package. Depending on the sample size, values over
.025 can be seen as mildly indicative of multimodality, while values over
.05 probably warrant closer inspection (the p-value can be obtained using
diptest::dip.test()
; also see Table 1 of Hartigan & Hartigan (1985) for
an indication as to critical values).
Hartigan, J. A.; Hartigan, P. M. The Dip Test of Unimodality. Ann. Statist. 13 (1985), no. 1, 70--84. doi:10.1214/aos/1176346577. https://projecteuclid.org/euclid.aos/1176346577.
Gjalt-Jorn Peters
Maintainer: Gjalt-Jorn Peters gjalt-jorn@userfriendlyscience.com
descr(mtcars$mpg); #> ###### Descriptives for mtcars$mpg #> #> Describing the central tendency: #> mean median mode 95% CI mean #> 20.09 19.2 (multi) [17.92; 22.26] #> #> Describing the spread: #> var sd iqr se #> 36.32 6.027 7.45 1.065 #> #> Describing the range: #> min q1 q3 max #> 10.4 15.2 22.8 33.9 #> #> Describing the distribution shape: #> skewness kurtosis dip #> 0.6724 -0.02201 0.0569 #> #> Describing the sample size: #> total NA. valid #> 32 0 32 #>