Learn R Programming

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

DescTools

Tools for Descriptive Statistics and Exploratory Data Analysis

Copy Link

Version

Install

install.packages('DescTools')

Monthly Downloads

104,795

Version

0.99.29

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

September 26th, 2019

Functions in DescTools (0.99.29)

BarnardTest

Barnard's Unconditional Test
AscToChar

Convert ASCII Codes to Characters and Vice Versa
Benford

Benford's Distribution
BinTree

Binary Tree
CollapseTable

Collapse Levels of a Table
Coalesce

Return the First Element Not Being NA
Between, Outside

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

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

Find the Closest Value
ColToRgb

Color to RGB Conversion
BoxedText

Add Text in a Box to a Plot
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
Assocs

Association Measures
AxisBreak

Place a Break Mark on an Axis
CochranQTest

Cochran's Q test
CombPairs

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

Concordance Correlation Coefficient
Asp

Get Aspect Ratio of the Current Plot
Atkinson

Atkinson Index - A Measure of Inequality.
BubbleLegend

Add a Legend to a Bubble Plot
CochranArmitageTest

Cochran-Armitage Test for Trend
BarText

Add the Value Labels to a Barplot
BinomCI

Confidence Intervals for Binomial Proportions
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
CompleteColumns

Find Complete Columns
Contrasts

Pairwise Contrasts
CatTable

Function to write a table
BoxCox

Box Cox Transformation
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
ConvUnit

Unit Conversion and Metrix Prefixes
ColToHsv

R Color to HSV Conversion
Clockwise

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

Convert a Color Into Hex String
BinomDiffCI

Confidence Interval for a Difference of Binomials
ConDisPairs

Concordant and Discordant Pairs
BreuschGodfreyTest

Breusch-Godfrey Test
BrierScore

Brier Score for Assessing Prediction Accuracy
Conf

Confusion Matrix And Associated Statistics
CronbachAlpha

Cronbach's Coefficient Alpha
CramerVonMisesTest

Cramer-von Mises Test for Normality
ColToGrey

Convert Colors to Grey/Grayscale
CohenKappa

Cohen's Kappa and Weighted Kappa
ColorLegend

Add a ColorLegend to a Plot
CrossN

n-dimensional Vector Cross Product
Cross

Vector Cross Product
CourseData

Get HWZ Datasets
ColumnWrap

ColumnWrap
BinomRatioCI

Confidence Intervals for the Ratio of Binomial and Multinomial Proportions
BootCI

Simple Bootstrap Confidence Intervals
BartelsRankTest

Bartels Rank Test of Randomness
Canvas

Canvas for Geometric Plotting
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and Vice Versa
CohenD

Cohen's Effect Size
CoefVar

Coefficient of Variation
ConnLines

Add Connection Lines to a Barplot
ConoverTest

Conover's Test of Multiple Comparisons
Association measures

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

Correlation, Variance and Covariance (Matrices)
CorPart

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

Polychoric Correlation
Cstat

C Statistic (Area Under the ROC Curve)
Divisors

Calculate Divisors
DoBy

Evaluates a Function Groupwise
CutQ

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

Count Complete Cases
DrawRegPolygon

Draw Regular Polygon(s)
DrawEllipse

Draw an Ellipse
Frechet

The Frechet Distribution
Frac

Fractional Part and Maximal Digits of a Numeric Value
Gompertz

The Gompertz distribution
DegToRad

Convert Degrees to Radians and Vice Versa
DenseRank

Dense Ranks and Percent Ranks
DoCall

Fast Alternative To The Internal do.call
Dot

Scalar Product
DescToolsOptions

DescTools Options
FixToTable

Convert a Text to a Table
Format

Format Numbers and Dates
DrawArc

Draw Elliptic Arc(s)
DrawBand

Draw Confidence Band
Gumbel

The Gumbel Distribution
GoodmanKruskalGamma

Goodman Kruskal's Gamma
GoodmanKruskalTau

Goodman Kruskal's Tau
InDots

Is a Specific Argument in the Dots-Arguments?
IsDate

Check If an Object Is of Type Date
JarqueBeraTest

(Robust) Jarque Bera Test
LineToUser

Convert Line Coordinates To User Coordinates
LogSt

Started Logarithmic Transformation and Its Inverse
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
MixColor

Compute the Convex Combination of Two Colors
DunnettTest

Dunnett's Test for Comparing Several Treatments With a Control
DigitSum

Calculate Digit Sum
DurbinWatsonTest

Durbin-Watson Test
Mode

Mode, Most Frequent Value(s)
PairApply

Pairwise Calculations
PageTest

Exact Page Test for Ordered Alternatives
Phrase

Phrasing Results of t-Test
Permn

Number and Samples for Permutations or Combinations of a Set
HoeffD

Matrix of Hoeffding's D Statistics
HosmerLemeshowTest

Hosmer-Lemeshow Goodness of Fit Tests
ExpFreq

Expected Frequencies
IsDichotomous

Test If a Variable Contains Only Two Unique Values
DivCoefMax

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

Rao's Diversity Coefficient
Desc

Describe Data
PlotCirc

Plot Circular Plot
IsEuclid

Is a Distance Matrix Euclidean?
LOF

Local Outlier Factor
LOCF

Last Observation Carried Forward
Entropy

Shannon Entropy and Mutual Information
LillieTest

Lilliefors (Kolmogorov-Smirnov) Test for Normality
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
Datasets for Simulation

Datasets for Probabilistic Simulation
Mean

(Weighted) Arithmetic Mean
Date Functions

Basic Date Functions
LinScale

Linear Scaling
PlotCorr

Plot a Correlation Matrix
ExtrVal

Distributions of Maxima and Minima
MeanAD

Mean Absolute Deviation From a Center Point
MedianCI

Confidence Interval for the Median
Midx

Find the Midpoints of a Numeric Vector
PearsonTest

Pearson Chi-Square Test for Normality
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
PercTable

Percentage Table
FisherZ

Fisher-Transformation for Correlation to z-Score
GTest

G-Test for Count Data
PlotMosaic

Mosaic Plots
HmsToSec

Convert h:m:s To/From Seconds
FindCorr

Determine Highly Correlated Variables
GCD, LCM

Greatest Common Divisor and Least Common Multiple
HodgesLehmann

Hodges-Lehmann Estimator of Location
IsValidHwnd

Check Windows Pointer
PlotPyramid

Draw a Back To Back Pyramid Plot
PlotCandlestick

Plot Candlestick Chart
PlotCashFlow

Cash Flow Plot
PlotQQ

QQ-Plot for Any Distribution
PlotMarDens

Scatterplot With Marginal Densities
Quot

Lagged Quotients
Quantile

Weighted Quantiles
RndPairs

Create Pairs of Correlated Random Numbers
DrawBezier

Draw a Bezier Curve
DrawCircle

Draw a Circle
Some numeric checks

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

Plot a Web of Connected Points
PlotMiss

Plot Missing Data
RobScale

Robust Scaling With Median and Mad
PowerPoint Interface

Add Slides, Insert Texts and Plots to PowerPoint
PoissonCI

Poisson Confidence Interval
GeomSn

Geometric Series
Shade

Produce a Shaded Curve
Depreciation

Several Methods of Depreciation of an Asset
StrAlign

String Alignment
StrAbbr

String Abbreviation
SD

(Weighted) Standard Deviation
SetNames

Set the Names in an Object
KappaM

Kappa for m Raters
RunsTest

Runs Test for Randomness
Primes

Find All Primes Less Than n
SpearmanRho

Spearman Rank Correlation
RoundTo

Round to Multiple
SortMixed

Sort Strings with Embedded Numbers Based on Their Numeric Order
DunnTest

Dunn's Test of Multiple Comparisons
Dummy

Generate Dummy Codes for a Factor
StrCountW

Count Words in a String
KendallTauA

Kendall's Tau-a
Extremes

Kth Smallest/Largest Values
StrIsNumeric

Does a String Contain Only Numeric Data
StrExtract

Extract Part of a String
FindColor

Get Color on a Defined Color Range
GenExtrVal

The Generalized Extreme Value Distribution
GetNewXL

Create a New Excel Instance
GeomTrans

Geometric Transformations
Fibonacci

Fibonacci Numbers
MeanCI

Confidence Interval for the Mean
Lc

Lorenz Curve
MeanDiffCI

Confidence Interval For Difference of Means
GenPareto

The Generalized Pareto Distribution
HotellingsT2Test

Hotelling's T2 Test
Gini

Gini Coefficient
HuberM

Safe (generalized) Huber M-Estimator of Location
Logit

Generalized Logit and Inverse Logit Function
MultinomCI

Confidence Intervals for Multinomial Proportions
IsOdd

Checks If An Integer Is Even Or Odd
List Variety Of Objects

List Objects, Functions Or Data in a Package
MultMerge

Merge Multiple Data Frames
IsPrime

IsPrime Property
StrDist

Compute Distances Between Strings
MosesTest

Moses Test of Extreme Reactions
MoveAvg

Moving Average
TOne

Create Table One Describing Baseline Characteristics
TitleRect

Plot Boxed Annotation
TMod

Comparison Table For Linear Models
ParseFormula

Parse a Formula and Create a Model Frame
PMT

Periodic Payment of an Annuity.
PDFManual

Get PDF Manual of a Package From CRAN
DescTools Palettes

Some Custom Palettes
PlotBag

Bivariate Boxplot
NPV

Short Selection of Financial Mathematical Functions
PlotBubble

Draw a Bubble Plot
NemenyiTest

Nemenyi Test
ParseSASDatalines

Parse a SAS Dataline Command
PlotLinesA

Plot Lines
GiniSimpson

Compute Gini-Simpson Coefficient
PlotLog

Logarithmic Plot
ErrBars

Add Error Bars to an Existing Plot
PlotTernary

Ternary or Triangular Plots
Gmean

Geometric Mean and Standard Deviation
Herfindahl

Concentration Measures
VarTest

ChiSquare Test for One Variance and F Test to Compare Two Variances
ToLong, ToWide

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

Create a Treemap
Recycle

Recyle a List of Elements
pRevGumbel

"Reverse" Gumbel Distribution Functions
RelRisk

Relative Risk
Rev

Reverse Elements of a Vector or the Rows/Columns of Matrices, Tables or Data.frames
SaveAs

Saves an R Object Under a Different Name
VecRot

Vector Rotation (Shift Elements)
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
WoolfTest

Woolf Test For Homogeneity in 2x2xk Tables
EtaSq

Effect Size Calculations for ANOVAs
Factorize

Prime Factorization of Integers
PolarGrid

Plot a Grid in Polar Coordinates
PasswordDlg

Password Dialog
PlotDot

Cleveland's Dot Plots
PlotDev

Plot to Device
Freq

Frequency Table for a Single Variable
FctArgs

Retrieve a Function's Arguments
UncertCoef

Uncertainty Coefficient
SignTest

Sign Test
StdCoef

Standardized Model Coefficients
Measures of Shape

Skewness and Kurtosis
ICC

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

Identify Closest Match to a Color Given by a Hexadecimal String
IdentifyA

Identify Points in Plot Lying Within a Rectangle or Polygon
RomanToInt

Convert Roman Numerals to Integers
PostHocTest

Post-Hoc Tests
Rotate

Rotate a Geometric Structure
WrdCaption

Insert Caption to Word
Freq2D

Bivariate (Two-Dimensional) Frequency Distribution
WrdParagraphFormat

Get or Set the Paragraph Format in Word
WrdPlot

Insert Active Plot to Word
d.periodic

Periodic Table of Elements
d.pizza

Data pizza
UnirootAll

Finds many (all) roots of one equation within an interval
WrdMergeCells

Merges Cells Of a Defined Word Table Range
WrdPageBreak

Insert a Page Break
KendallTauB

Kendall Tau-b
KendallW

Kendall's Coefficient of Concordance W
LehmacherTest

Lehmacher's Test for Marginal Homogenity
GetCurrWrd

Get a Handle to a Running Word Instance
StrPad

Pad a String With Justification
Strata

Stratified Sampling
Str

Compactly Display the Structure of any R Object
StrPos

Find Position of First Occurrence Of a String
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
HexToRgb

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

Harmonic Mean and Its Confidence Interval
GetNewWrd

Create a New Word Instance
WrdSaveAs

Save Word Document
LeveneTest

Levene's Test for Homogeneity of Variance
Sample

Random Samples and Permutations
Keywords

List Keywords For R Manual Pages
WrdStyle

Get or Set the Style in Word
d.countries

ISO 3166-1 Country Codes
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
%nin%

Find Matching (or Non-Matching) Elements
d.diamonds

Data diamonds
SampleTwins

Sample Twins
TextToTable

Converts String To a Table
MAD

Median Absolute Deviation
VarCI

Confidence Intervals for the Variance
TheilU

Theil's U Index of Inequality
VIF

Variance Inflation Factors
SmoothSpline

Formula Interface For smooth.spline
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
Label, Unit

Label, Unit Attribute of an Object
Lambda

Goodman Kruskal Lambda
WrdInsertBookmark

Insert a Bookmark, Goto Bookmark and Update the Text of a Bookmark
split.formula

Formula Interface for Split
WrdFormatCells

Format Cells Of a Word Table
Some

Return Some Randomly Chosen Elements of an Object
MHChisqTest

Mantel-Haenszel Chi-Square Test
Mar

Set Plot Margins
MeanSE

Standard Error of Mean
Median

(Weighted) Median Value
Order

Distributions of Order Statistics
StrSpell

Spell a String Using the NATO Phonetic or the Morse Alphabet
Measures of Accuracy

Measures of Accuracy
ORToRelRisk

Transform Odds Ratio to Relative Risk
PlotACF

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

Outlier
PlotFdist

Frequency Distribution Plot
PlotECDF

Empirical Cumulative Distribution Function
PlotFaces

Chernoff Faces
PlotArea

Create an Area Plot
PlotFun

Plot a Function
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PlotMultiDens

Plot Multiple Density Curves
StrTrim

Remove Leading/Trailing Whitespace From A String
TextContrastColor

Choose Textcolor Depending on Background Color
TTestA

Student's t-Test Based on Sample Statistics
PseudoR2

Pseudo R2 Statistics
Rename

Change Names of a Named Object
XLDateToPOSIXct

Convert Excel Dates to POSIXct
PtInPoly

Point in Polygon
PlotPolar

Plot Values on a Circular Grid
reorder.factor

Reorder the Levels of a Factor
PlotVenn

Plot a Venn Diagram
SendOutlookMail

Send a Mail Using Outlook as Mail Client
SetAlpha

Add an Alpha Channel To a Color
WrdCellRange

Return the Cell Range Of a Word Table
PlotViolin

Plot Violins Instead of Boxplots
RevWeibull

The Reverse Weibull Distribution
Recode

Recode a Factor
Range

(Robust) Range
XLGetRange

Import Data Directly From Excel
Sort

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

Somers' Delta
SplitAt

Split a Vector Into Several Pieces at Given Positions
WrdFont

Get or Set the Font in Word
DescTools Aliases

Some Aliases Set for Convenience
SplitPath

Split Path In Drive, Path, Filename
StrRev

Reverse a String
StrLeft, StrRight

Returns the Left Or the Right Part Of a String
StuartTauC

Stuart \(\tau_{c}\)
XLSaveAs

Save Excel File
XLView

Use MS-Excel as Viewer for a Data.Frame
RgbToCol

Find the Nearest Named R-Color to a Given RGB-Color
SysInfo

System Information
ToWrd

Send Objects to Word
ShapiroFranciaTest

Shapiro-Francia Test for Normality
ZeroIfNA

Replace NAs by 0
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
wdConst

Word VBA Constants
YuenTTest

Yuen t-Test For Trimmed Means
matpow

Matrix Power
ZTest

Z Test for Known Population Standard Deviation
Trim

Trim a Vector
d.whisky

Classification of Scotch Single Malts
day.name

Build-in Constants Extension
Zodiac

Calculate the Zodiac of a Date
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
StrCap

Capitalize the First Letter of a String
Stamp

Date/Time/Directory Stamp the Current Plot
StrTrunc

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

Extract All Numeric Values From a String
StrChop

Split a String into a Number of Sections of Defined Length
Vigenere

Vigenere Cypher
VonNeumannTest

Von Neumann's Successive Difference Test
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
TwoGroups

Describe a Variable by a Factor with Two Levels
Unwhich

Inverse Which
Untable

Recover Original Data From Contingency Table
Winsorize

Winsorize (Replace Extreme Values by Less Extreme Ones)
WithOptions

Execute Function with Temporary Options
WrdTable

Insert a Table in a Word Document
as.matrix.xtabs

Convert xtabs To matrix
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
lines.lm

Add a Linear Regression Line
lines.loess

Add a Loess or a Spline Smoother
WrdTableBorders

Draw Borders to a Word Table
%like%

Like Operator
identify.formula

Identify Points In a Plot Using a Formula
%c%

Concatenates Two Strings Without Any Separator
power.chisq.test

Power Calculations for ChiSquared Tests
Agree

Raw Simple And Extended Percentage Agreement
AddMonthsYM

Add a Month to a Date in YearMonth Format
Abstract

Display Compact Abstract of a Data Frame
Append

Append Elements to Objects
Arrow

Insert an Arrow Into a Plot
AddMonths

Add a Month to a Date
AllDuplicated

Index Vector of All Values Involved in Ties
AUC

Area Under the Curve
Abind

Combine Multidimensional Arrays