Learn R Programming

⚠️There's a newer version (0.99.57) of this package.Take me there.

DescTools (version 0.99.19)

Tools for Descriptive Statistics

Description

A collection of miscellaneous basic statistic functions and convenience wrappers for efficiently describing data. The author's intention was to create a toolbox, which facilitates the (notoriously time consuming) first descriptive tasks in data analysis, consisting of calculating descriptive statistics, drawing graphical summaries and reporting the results. The package contains furthermore functions to produce documents using MS Word (or PowerPoint) and functions to import data from Excel. Many of the included functions can be found scattered in other packages and other sources written partly by Titans of R. The reason for collecting them here, was primarily to have them consolidated in ONE instead of dozens of packages (which themselves might depend on other packages which are not needed at all), and to provide a common and consistent interface as far as function and arguments naming, NA handling, recycling rules etc. are concerned. Google style guides were used as naming rules (in absence of convincing alternatives). The 'camel style' was consequently applied to functions borrowed from contributed R packages as well.

Copy Link

Version

Install

install.packages('DescTools')

Monthly Downloads

79,502

Version

0.99.19

License

GPL (>= 2)

Maintainer

Last Published

February 11th, 2017

Functions in DescTools (0.99.19)

as.matrix.xtabs

Convert xtabs To matrix
AscToChar

Convert ASCII Codes to Characters and Vice Versa
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
AxisBreak

Place a Break Mark on an Axis
Assocs

Association Measures
Benford

Benford's Distribution
BarText

Add Text to a Barplot
Asp

Aspect Ratio
BartelsRankTest

Bartels Rank Test
Atkinson

Calculate the Atkinson Index
AUC

Area Under the Curve
BoxCox

Box Cox Transformation
BinTree

Binary Tree
BinomCI

Confidence Intervals for Binomial Proportions
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
Between, Outside

Operators To Check, If a Value Lies Within Or Outside a Given Range
BootCI

Simple Bootstrap Confidence Intervals
BinomDiffCI

Confidence Interval for a Difference of Binomials
BinToDec

Converts Numbers From Binmode, Octmode or Hexmode to Decimal and Vice Versa
BoxedText

Add Text in a Box to a Plot
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and Vice Versa
CatTable

Function to write a table
BubbleLegend

Add a Legend to a Bubble Plot
Canvas

Canvas for Geometric Plotting
CorPart

Find the Correlations for a Set x of Variables With Set y Removed
CochranQTest

Cochran's Q test
CorPolychor

Polychoric Correlation
CochranArmitageTest

Cochran-Armitage Test for Trend
ColumnWrap

ColumnWrap
CombPairs

Get All Pairs Out of One or Two Sets of Elements
ClipToVect

Reformat a Table in the Clipboard as Vector
Clockwise

Calculates Begin and End Angle From a List of Given Angles in Clockwise Mode
ColToGrey

Convert Colors to Grey/Grayscale
ColToHex

Convert a Color Into Hex String
d.pizza

Data pizza
ChooseColorDlg

Display Color Dialog to Choose a Color
CCC

Concordance Correlation Coefficient
Closest

Find the Closest Value
d.periodic

Periodic Table of Elements
Coalesce

Return the First Element Not Being NA
ColToHsv

R Color to HSV Conversion
ColToRgb

Color to RGB Conversion
Association measures

Cramer's V, Pearson's Contingency Coefficient and Phi Coefficient Yule's Q and Y, Tschuprow's T
CronbachAlpha

Cronbach's Coefficient Alpha
BreuschGodfreyTest

Breusch-Godfrey Test
ConDisPairs

Concordant and Discordant Pairs
ColPicker

Plot All Named R Colors
BrierScore

Brier Score
ColorLegend

Add a ColorLegend to a Plot
ConnLines

Add Connection Lines to a Barplot
DescToolsOptions

DescTools Options
DunnTest

Dunn's Test of Multiple Comparisons
DunnettTest

Dunnett's Test for Comparing Several Treatments With a Control
Datasets for Simulation

Datasets for Probabilistic Simulation
DigitSum

Calculate Digit Sum
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
ErrBars

Add Error Bars to an Existing Plot
d.whisky

Classification of Scotch Single Malts
Frac

Fractional Part and Maximal Digits of a Numeric Value
Freq

Frequency Table
HexToRgb

Convert a Hexstring Color to a Matrix With Three Red/Green/Blue Rows
DrawEllipse

Draw an Ellipse
DenseRank

Dense Ranks
Hmean

Harmonic Mean and Its Confidence Interval
Desc

Describe Data
ExpFreq

Expected Frequencies
Factorize

Prime Factorization of Integers
DrawCircle

Draw a Circle
GetNewPP

Create a New PowerPoint Instance
GetNewWrd

Create a New Word Instance
DrawBezier

Draw a Bezier Curve
GiniSimpson

Compute Gini-Simpson Coefficient
Gmean

Geometric Mean and Standard Deviation
DivCoef

Rao's Diversity Coefficient
DivCoefMax

Maximal value of Rao's diversity coefficient also called quadratic entropy
Fibonacci

Fibonacci Numbers
FctArgs

Retrieve a Function's Arguments
FileOpenCmd

Get Path of a Data File to Be Opened
DrawBand

Draw Confidence Band
FindColor

Get Color on a Defined Color Range
ICC

Intraclass Correlations (ICC1, ICC2, ICC3 From Shrout and Fleiss)
HWZdata

Get HWZ Datasets
Date

Create a Date From Numeric Representation
Entropy

Shannon Entropy and Mutual Information
FindCorr

Determine Highly Correlated Variables
FixToTab

Text to Table
GetNewXL

Create a New Excel Instance
Gini

Gini Coefficient
DurbinWatsonTest

Durbin-Watson Test
Date Functions

Basic Date Functions
HodgesLehmann

Hodges-Lehmann Estimator of Location
HoeffD

Matrix of Hoeffding's D Statistics
HosmerLemeshowTest

Hosmer-Lemeshow Goodness of Fit Tests
Arrow

Insert an Arrow
HmsToSec

Convert h:m:s To/From Seconds
LogSt

Started Logarithmic Transformation and Its Inverse
lines.lm

Add a Linear Regression Line
lines.loess

Add a Loess or a Spline Smoother
IsEuclid

Is a Distance Matrix Euclidean?
IsOdd

Checks If An Integer Is Even Or Odd
Lookup

Look Up a Value In a Reference Vector
%c%

Concatenates Two Strings Without Any Separator
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
AllDuplicated

Index Vector of All Values Involved in Ties
DrawRegPolygon

Draw Regular Polygon(s)
d.countries

ISO 3166-1 Country Codes
GCD, LCM

Greatest Common Divisor and Least Common Multiple
GeomTrans

Geometric Transformations
Dummy

Generate Dummy Codes for a Factor
d.diamonds

Data diamonds
GoodmanKruskalGamma

Goodman Kruskal's Gamma
GoodmanKruskalTau

Goodman Kruskal's Tau
IsDate

Check If an Object Is of Type Date
IsDichotomous

Test If a Variable Contains Only Two Unique Values
Lc

Lorenz Curve
LehmacherTest

Lehmacher's Test for Marginal Homogenity
LineToUser

Convert Line Coordinates To User Coordinates
MeanAD

Mean Absolute Deviation From a Center Point
LinScale

Linear Scaling
Mean

Arithmetic Mean
Median

Median Value
median.factor

Median for Ordered Factors
Abind

Combine Multidimensional Arrays
KendallTauB

Kendall Tau-b
Abstract

Abstract
DescTools Aliases

Some Aliases Set for Convenience
NemenyiTest

Nemenyi Test
KendallW

Kendall's Coefficient of Concordance W
MoveAvg

Moving Average
MultinomCI

Confidence Intervals for Multinomial Proportions
PartitionBy

PartitionBy Evaluates a Function Groupwise
PasswordDlg

Password Dialog
PlotCorr

Plot a Correlation Matrix
PlotMiss

Plot Missing Data
PlotDev

Plot to Device
PlotMatrix

Scatterplot Matrix
Primes

Find All Primes Less Than n
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
PlotMultiDens

Plot Multiple Density Curves
PlotPch

Information Plots
Rev

Reverse Elements of a Vector or the Rows/Columns of Matrices and Tables
reorder.factor

Reorder the Levels of a Factor
SortMixed

Order or Sort Strings With Embedded Numbers So That The Numbers Are In The Correct Order
SpearmanRho

Spearman Rank Correlation
split.formula

Formula Interface for Split
SplitPath

Split Path In Drive, Path, Filename
StrRev

Reverse a String
RoundTo

Round to Multiple
SampleTwins

Sample Twins
StrLeft, StrRight

Returns the Left Or the Right Part Of a String
VarTest

ChiSquare Test for One Variance and F Test to Compare Two Variances
VarCI

Confidence Interval for the Variance
LeveneTest

Levene's Test for Homogeneity of Variance
Some numeric checks

Check a Vector For Being Numeric, Zero Or a Whole Number
JarqueBeraTest

(Robust) Jarque Bera Test
%like%

Like Operator
KappaM

Kappa for m Raters
KendallTauA

Kendall's Tau-a
HotellingsT2Test

Hotelling's T2 Test
HuberM

Safe (generalized) Huber M-Estimator of Location
AddClass

Add and Remove Classes From an Object
IsPrime

IsPrime Property
AddMonths

Add a Month to a Date
List Variety Of Objects

List Objects, Functions Or Data in a Package
Measures of Accuracy

Measures of Accuracy
Lambda

Goodman Kruskal Lambda
IsValidWrd

Check Word Pointer
Extremes

Kth Smallest/Largest Values
LOCF

Last Observation Carried Forward
LOF

Local Outlier Factor
MeanCI

Confidence Interval for the Mean
%nin%

Find Matching (or Non-Matching) Elements
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PlotCandlestick

Plot Candlestick Chart
ParseSASDatalines

Parse a SAS Dataline Command
ParseFormula

Parse a Formula and Create a Model Frame
Midx

Find the Midpoints of a Numeric Vector
MixColor

Compute the Convex Combination of Two Colors
MeanDiffCI

Confidence Interval For Difference of Means
PlotCirc

Plot Circular Plot
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
PlotLog

Logarithmic Plot
PlotMarDens

Scatterplot With Marginal Densities
PlotQQ

QQ-Plot for Any Distribution
ORToRelRisk

Transform Odds Ratio to Relative Risk
Outlier

Outlier
MHChisqTest

Mantel-Haenszel Chi-Square Test
MedianCI

Confidence Interval for the Median
PlotMosaic

Mosaic Plots
PlotTernary

Ternary or Triangular Plots
PseudoR2

Pseudo R2 Statistics
PtInPoly

Point in Polygon
XLDateToPOSIXct

Convert Excel Dates to POSIXct
wdConst

Word VBA Constants
PDFManual

Get PDF Manual Of a Package From CRAN
PlotFun

Plot a Function
PlotArea

Create an Area Plot
PlotACF

Combined Plot of a Time Series and Its ACF and PACF
WrdTableBorders

Draw Borders to a Word Table
Vigenere

Vigenere Cypher
RomanToInt

Convert Roman Numerals to Integers
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
PageTest

Exact Page Test for Ordered Alternatives
PlotPyramid

Draw a Back To Back Pyramid Plot
RndPairs

Create Pairs of Correlated Random Numbers
RobScale

Robust Scaling With Median and Mad
PlotLinesA

Plot Lines
PlotPolar

Plot Values on a Circular Grid
Permn

Number and Samples for Permutations or Combinations of a Set
Phrase

Phrasing Results of t-Test
Recycle

Recyle a List of Elements
PlotECDF

Empirical Cumulative Distribution Function
PlotDot

Cleveland's Dot Plots
PolarGrid

Plot a Grid in Polar Coordinates
PoissonCI

Poisson Confidence Interval
StrCap

Capitalize the First Letter of a String
Rotate

Rotate a Geometric Structure
Recode

Recode a Factor
StrChop

Split a String in a Number of Pieces With Fixed Length
TMod

Comparison Table For Linear Models
TOne

Create Table One Describing Baseline Characteristics
WrdStyle

Get or Set the Style in Word
Trim

Trim a Vector
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
WrdTable

Insert a Table in a Word Document
Measures of Shape

Skewness and Kurtosis
SmoothSpline

Formula Interface For smooth.spline
Str

Compactly Display the Structure of an Arbitrary R Object
StrAbbr

String Abbreviation
StrTrim

Remove Leading/Trailing Whitespace From A String
StrTrunc

Truncate Strings and Add Ellipses If a String is Truncated.
TextContrastColor

Choose Textcolor Depending on Background Color
TextToTable

Converts String To a Table
ToLong, ToWide

Reshape a Vector From Long to Wide Shape Or Vice Versa
ToWrd

Send Objects to Word
PlotTreemap

Create a Treemap
PlotVenn

Plot a Venn Diagram
Quantile

Weighted Quantiles
Range

(Robust) Range
pRevGumbel

"Reverse" Gumbel Distribution Functions
SD

Standard Deviation
RgbToCol

Find the Named R-Color Which Is Nearest to a Given RGB-Color
SelectVarDlg

Select Elements of a Set by Click
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
SignTest

Sign Test
Agree

Raw Simple And Extended Percentage Agreement
CohenD

Cohen's Effect Size
AddMonthsYM

Add a Month to a Date
CollapseTable

Collapse Levels of a Table
Contrasts

Pairwise Contrasts
Cor

Correlation, Variance and Covariance (Matrices)
day.name

Build-in Constants Extension
CutQ

Create a Factor Variable Using the Quantiles of a Continuous Variable
Cstat

C Statistic (Area Under the ROC Curve)
DegToRad

Convert Degrees to Radians and Vice Versa
SaveAsDlg

Save R Objects By Choosing a File Interactively
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
Some

Return Some Randomly Chosen Elements of an Object
Sort

Sort a Vector, a Matrix, a Table or a Data.frame
StrAlign

String Alignment
Strata

Stratified Sampling
StrDist

Compute Distances Between Strings
StrExtract

Extract Part of a String
StuartTauC

Stuart $Tau C$
SysInfo

System Information
WrdInsertBookmark

Insert a Bookmark, Goto Bookmark and Update the Text of a Bookmark
VecRot

Vector Rotation
VIF

Variance Inflation Factors
WrdMergeCells

Merges Cells Of a Defined Word Table Range
WrdParagraphFormat

Get or Set the Paragraph Format in Word
WrdPlot

Insert Active Plot to Word
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
StrPad

Pad a String With Justification
Stamp

Date/Time/Directory Stamp the Current Plot
StrIsNumeric

Does a String Contain Only Numeric Data
StrVal

Extract All Numeric Values From a String
WrdCellRange

Return the Cell Range Of a Word Table
XLGetRange

Import Data Directly From Excel
WrdCaption

Insert Caption to Word
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
YuenTTest

Yuen t-Test For Trimmed Means
XLView

Use Excel as Viewer for a Data.Frame
Winsorize

Winsorize
WoolfTest

Woolf Test
Xplore

Interactive Graphical Data Explorer
ZeroIfNA

Replace NAs by 0
DoCall

Fast Alternative To The Internal do.call
Zodiac

Calculate the Zodiac of a Date
DrawArc

Draw Elliptic or Circular Arc(s)
EtaSq

Effect Size Calculations for ANOVAs
IdentifyA

Identify Points in Plot Lying Within a Rectangle or Polygon
ImportFileDlg

Import File In Foreign Format
Exec

Execute a Command Given As String
InDots

Is a Specific Argument in the Dots-Arguments?
Keywords

List Keywords For R Manual Pages
GTest

G-Test for Count Data
HexToCol

Identify Closest Match to a Color Given by a Hexadecimal String
identify.formula

Identify Points In a Plot Using a Formula
Label, Unit

Label, Unit Attribute of an Object
Logit

Generalized Logit and Inverse Logit Function
Mar

Set Plot Margins
matpow

Matrix Power
LogLin

Log Linear Hybrid, Generalized Log
Mode

Mode
MosesTest

Moses Test of Extreme Reactions
PairApply

Pairwise Calculations
DescTools Palettes

Some Custom Palettes
PearsonTest

Pearson Chi-Square Test for Normality
PercTable

Percentage Table
PlotBag

PlotBag, a Bivariate Boxplot
PlotBubble

Draw a Bubble Plot
PlotFaces

Chernoff Faces
PlotFdist

Frequency Distribution Plot
power.chisq.test

Power Calculations for ChiSquared Tests
RelRisk

Relative Risk
PlotViolin

Plot Violins Instead of Boxplots
PlotWeb

Plot a Web of Connected Points
PostHocTest

Post-Hoc Tests
Rename

Change Names of a Named Object
SetAlpha

Add an Alpha Channel To a Color
SetRowNames

Set the Row Names and Column Names in an Object
Shade

Produce a Shaded Curve
ShapiroFranciaTest

Shapiro-Francia Test for Normality
Unwhich

Inverse Which
Untable

Recover Original Data From Contingency Table
StrRep

Repeat the Elements of a Character Vector
TheilU

Theil's U Index of Inequality
TitleRect

Plot Boxed Annotation
StrPos

Find Position of First Occurrence Of a String
WrdFont

Get or Set the Font in Word
WrdFormatCells

Format Cells Of a Word Table
ZTest

Z Test for Known Population Standard Deviation