Learn R Programming

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

DescTools (version 0.99.13)

Tools for Descriptive Statistics

Description

A collection of 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

70,934

Version

0.99.13

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

August 24th, 2015

Functions in DescTools (0.99.13)

IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
Assocs

Association Measures
Agree

Raw Simple And Extended Percentage Agreement
Date

Create a Date from Numeric Representation
CronbachAlpha

Cronbach's Coefficient Alpha
Conf

Confusion Matrix And Associated Statistics
ColToHsv

R Color to HSV Conversion
Desc.formula

Describe Variables by Groups
CoefVar

Coefficient of Variation
ColToRgb

Color to RGB Conversion
Format

Format Numbers and Dates
BinToDec

Converts numbers from binmode, octmode or hexmode to decimal and vice versa
Atkinson

Calculate the Atkinson Index
DrawArc

Draw Elliptic or Circular Arc(s)
Desc.Date

Describe a Date Vector
Canvas

Canvas for Geometric Plotting
BinomCI

Confidence Intervals for Binomial Proportions
ColToHex

Convert a Color into Hex String
ConDisPairs

Concordant and Discordant Pairs
GoodmanKruskalGamma

Goodman Kruskal's Gamma
ConnLines

Add Connection Lines to a Barplot
CollapseTable

Collapse Levels of a Table
EtaSq

Effect size calculations for ANOVAs
DoCall

Fast Alternative To The Internal do.call
CochranArmitageTest

Cochran-Armitage test for trend
BoxedText

Add Text in a Box to a Plot
DegToRad

Convert Degrees to Radians and vice versa
SetAlpha

Add an Alpha Channel To a Color
BubbleLegend

Add a Legend to a Bubble Plot
DunnTest

Dunn's Test of Multiple Comparisons
CatTable

Function to write a table
DrawRegPolygon

Draw Regular Polygon(s)
DrawAnnulus

Draw One or Several Annuli
ColorLegend

Add a ColorLegend to a Plot
FindColor

Get Color on a Defined Color Range
Abind

Combine multi-dimensional arrays
AxisBreak

Place a Break Mark on an Axis
Association measures

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

Box Cox Transformation
AUC

Area Under the Curve
GoodmanKruskalTauA

Goodman Kruskal's Tau a
Desc.data.frame

Describe a data.frame Or a List
CutQ

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

Polychoric Correlation
DivCoefMax

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

Reformat a Table in the Clipboard as Vector
Rename

Change Names of a Named Object
Fibonacci

Fibonacci Numbers
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
CochranQTest

Cochran's Q test
CohenD

Cohen's Effect Size
Clockwise

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

Lehmacher's Test for Marginal Homogenity
Midx

Find the Midpoints of a Numeric Vector
Between, Outside

Operators To Check, If a Value Lies Within Or Outside a Given Range
Desc.table

Describe a n-dimensional Contingency Table
PearsonTest

Pearson chi-square test for normality
OddsRatio

Odds Ratio Estimation and Confidence Intervals
BartelsRankTest

Bartels Rank Test
Dummy

Generate Dummy Codes for a Factor
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
AscToChar

Convert ASCII Codes to Characters and Vice Versa
LOF

Local Outlier Factor
AllDuplicated

Index Vector of All Values Involved in Ties
CCC

Concordance Correlation Coefficient
Date Functions

Basic Date Functions
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
DurbinWatsonTest

Durbin-Watson Test
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
Closest

Find the Closest Value
KendallW

Kendall's Coefficient of Concordance W
Factorize

Prime Factorization of Integers
HotellingsT2Test

Hotelling's T2 Test
DenseRank

Dense Ranks
HuberM

Safe (generalized) Huber M-Estimator of Location
LogSt

Started Logarithmic Transformation and Its Inverse
DrawAnnulusSector

Draw a Sector of an Annulus
Desc.logical

Describe a dichotomous variable
Desc.factor

Describe a Factor, an Ordered Factor Or a Character Vector
ChooseColorDlg

Display Color Dialog to Choose a Color
Desc.numeric

Describe a numeric vector
GCD, LCM

Greatest Common Divisor and Least Common Multiple
GetNewXL

Create a new Excel Instance
ExpFreq

Expected frequencies
Desc

Describe Data
SomersDelta

Somers' Delta
HighLow

Return the Lowest and the Highest Values and Their Frequencies
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
DrawEllipse

Draw an Ellipse
PDFManual

Get PDF Manual Of a Package From CRAN
PercTable

Percentage Table
PlotMatrix

Scatterplot Matrix
Freq

Frequency Table
Gini

Gini Coefficient
KappaM

Kappa for m raters
ParseSASDatalines

Parse a SAS Dataline Command
HoeffD

Matrix of Hoeffding's D Statistics
HexToCol

Identify closest match to a color given by a hexadecimal string
PartCor

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

Retrieve a Functions' Arguments
PlotECDF

Empirical Cumulative Distribution Function
PlotHorizBar

Plot Horizontal Bars
PageTest

Exact Page Test for Ordered Alternatives
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
GTest

G-Test for Count Data
Coalesce

Return the First Element Not Being NA
Mar

Set Plot Margins
DrawCircle

Draw a Circle
IsDate

Check if an Object is of Type Date
PoissonCI

Poisson Confidence Interval
Keywords

List valid Keywords for R man pages
Trim

Trim a Vector
StrLeft, StrRight

Returns the Left Part Or the Right Part Of a String
IsValidWrd

Check Word Pointer
GiniSimpson

Compute Gini-Simpson Coefficient
Lc

Lorenz Curve
PlotDesc

Display descriptive plots
GetNewWrd

Create a new Word Instance
CohenKappa

Cohen's Kappa and Weighted Kappa
WoolfTest

Woolf Test
ColToGrey

Convert Colors to Grey/Grayscale
SampleTwins

Sample Twins
Desc.integer

Describe an integer variable
IsEuclid

Is a Distance Matrix Euclidean?
PlotTernary

Ternary or Triangular Plots.
Exec

Execute a Command Given As String
Desc.flags

Describe a Set of Dichotomous Variables
PlotDot

Cleveland's Dot Plots
FixToTab

Text to Table
Ray

Compact Information About the Columns of a Data Frame
GetCurrWrd

Get a Handle to a Running Word Instance
FisherZ

Fisher r to z and z to r and confidence intervals
SignTest

Sign Test
MeanSE

Standard error of mean
LOCF

Last Observation Carried Forward
Strata

Stratified sampling
PlotMarDens

Scatterplot with Marginal Densities
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
KendallTauB

Kendall tau-b
Extremes

Kth Smallest/Largest Values
Logit

Generalized Logit and Inverse Logit function
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
Frac

Fractional Part and Maximal Digits of a Numeric Value
ImportDlg

Get Path of a Data File to Be Opened
PlotMultiDens

Plot Multiple Density Curves
MeanDiffCI

Confidence Interval For Difference of Means
PlotLinesA

Plot Lines
identify.formula

Identify points in a plot using a formula.
LeveneTest

Levene's Test for Homogeneity of Variance
DivCoef

Rao's diversity coefficient also called quadratic entropy
Ndec

Count Decimal Places of a Number
NPV

One Period Returns, Net Present Value and Internal Rate of Return
PlotCirc

Plot Circular Plot
Str

Compactly Display the Structure of an Arbitrary R Object
PlotFdist

Frequency Distribution Plot
PairApply

Pairwise Calculations
DrawBand

Draw Confidence Band
PlotPolar

Plot Values on a Circular Grid
PlotQQ

QQ-Plot for Any Distribution
MedianCI

Confidence Interval for the Median
PostHocTest

Post-Hoc Tests
SplitPath

Split Path In Drive, Path, Filename
Stamp

Date/Time/Directory Stamp the Current Plot
Gmean

Geometric Mean and Standard Deviation
MixColor

Compute the convex combination of two colors
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
StrChop

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

Is a Specific Argument in the Dots-Arguments?
DrawBezier

Draw a Bezier Curve
Some numeric checks

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

Goodman Kruskal Lambda
ToLong, ToWide

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

Converts String To a Table
StuartTauC

Stuart $\tau_{c}$
PlotACF

Combined Plot of a Time Series and its ACF and PACF
DescTools Palettes

Some Custom Palettes
WrdInsertBookmark

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

Z Test for Known Population Standard Deviation
%like%

Like operator
Entropy

Shannon Entropy and Mutual Information
d.periodic

Periodic Table of Elements
Winsorize

Winsorize
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
d.countries

ISO 3166-1 Country Codes
WrdInsTab

Insert a Table in a Word Document
median.factor

Median for Ordered Factors
StrDist

Compute Distances Between Strings
RelRisk

Relative Risk
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
IsOdd

Checks If An Integer Is Even Or Odd
RunsTest

Runs Test for Randomness
PtInPoly

Point in Polygon
GetNewPP

Create a new PowerPoint Instance
WrdText

Insert Normal Text to Word
PlotFaces

Chernoff Faces
StrAbbr

String Abbreviation
split.formula

Formula Interface for Split
MeanAD

Mean Absolute Deviation From a Center Point
%c%

Concatenates two strings without any separator.
PlotFun

Plot a Function
Contrasts

Pairwise Contrasts
ShapiroFranciaTest

Shapiro-Francia test for normality
Vigenere

Vigenere Cypher
StrPos

Find Position of First Occurrence Of a String
wdConst

Word VBA constants
PlotVenn

Plot a Venn Diagram
NemenyiTest

Nemenyi Test
StrTrim

Remove Leading/Trailing Whitespace From A String
TextContrastColor

Choose Textcolor Depending on Background Color
StrTrunc

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

Use Excel as Viewer for a Data.Frame
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
TheilU

Theil's U index of inequality
pRevGumbel

"Reverse" Gumbel Distribution Functions
day.name

Build-in Constants Extension
MeanCI

Confidence Interval for the Mean
JarqueBeraTest

(Robust) Jarque Bera Test
VarCI

Confidence Interval for the Variance
MultinomCI

Confidence Intervals for Multinomial Proportions
SortMixed

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

Yuen t-Test For Trimmed Means
ErrBars

Add Error Bars to an Existing Plot
lines.loess

Add a Loess or a Spline Smoother
UncertCoef

Uncertainty Coefficient
Untable

Recover Original Data From Contingency Table
LsFct

List Functions of a Package
FindCorr

Determine highly correlated variables
WrdPlot

Insert Active Plot to Word
RobRange

Robust Range
SpearmanRho

Spearman Rank Correlation
Primes

Find all Primes Less Than n
PlotArea

Create an Area Plot
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
IsDichotomous

Test If a Variable Contains Only Two Unique Values
ICC

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

Parse a Formula and Create a Model Frame
LinScale

Perform a linear scaling of x
SaveAsDlg

Save R Objects By Choosing a File Interactively
Rev

Reverse Elements of a Vector or the Rows/Columns of Matrices and Tables
Recycle

Recyle a List of Elements
MHChisqTest

Mantel-Haenszel Chi-Square Test
Measures of Shape

Skewness and Kurtosis
XLGetRange

Import Data Directly From Excel
SysInfo

System Information And DescTools Options
XLDateToPOSIXct

Convert Excel Dates to POSIXct
PartitionBy

PartitionBy Evaluates a Function Groupwise
Zodiac

Calculate the Zodiac of a Date
PlotTreemap

Create a Treemap
PolarGrid

Plot a Grid in Polar Coordinates
PlotMosaic

Mosaic Plots
PlotPyramid

Draw a Back To Back Pyramid Plot
MoveAvg

Moving Average
VecRot

Vector Rotation
Rotate

Rotate a Geometric Structure
MosesTest

Moses Test of Extreme Reactions
WrdCaption

Insert Caption to Word
Permn

Number and Samples for Permutations or Combinations of a Set
Outlier

Outlier
WrdR

Insert a R Command and It's Output in a Word Document
d.pizza

Data pizza
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
WrdSetFont

Set the Font in Word
HmsToSec

Convert h:m:s To/From Seconds
StrIsNumeric

Does a String Contain Only Numeric Data
Label

Label Attribute of an Object
StrCountW

Count Words in a String
LogLin

Log Linear Hybrid, Generalized Log
PlotRCol

Information plots
RndPairs

Create Pairs of Correlated Random Numbers
RoundM

Round to Multiple
PlotBubble

Draw a Bubble Plot
AddMonths

Add a Month to a Date
BinTree

Binary Tree
WrdTable

Produces a Table in Word
reorder.factor

Reorder the Levels of a Factor
Xplore

Interactive Graphical Data Explorer
TOne

Create Table One Describing Baseline Characteristics
Benford

Benford's Distribution
power.chisq.test

Power Calculations for ChiSquared Tests
CramerVonMisesTest

Cramer-von Mises test for normality
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
RgbToCol

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

Get All Pairs out of one or two Sets of Elements
Hmean

Harmonic mean
ImportFileDlg

Import File In Foreign Format
PasswordDlg

Password Dialog
IsPrime

IsPrime Property
Recode

Recode a Factor
PlotBag

PlotBag, a bivariate boxplot
SelectVarDlg

Select Elements of a Set by Click
UnitConv

Unit Conversion
DunnettTest

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

Plot a Correlation Matrix
SetRowNames

Set the Row Names and Column Names in an Object
Sort

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

Replace NAs by 0
as.matrix.xtabs

Convert xtabs To matrix
RobScale

Robust Scaling With Median and Mad
StrCap

Capitalize the First Letter of a String
BinomDiffCI

Confidence Interval for a Difference of Binomials
DescWrd

Use Word as Reporting Tool for Describing Data
Herfindahl

Concentration Measures
HexToRgb

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

Hodges-Lehmann Estimator of Location
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
Mode

Mode
PlotCandlestick

Plot Candlestick Chart
PlotWeb

Plot a Web of Connected Points
PlotViolin

Plot Violins Instead of Boxplots
StrRev

Reverse a String
StrVal

Extract All Numeric Values From a String
StrPad

Pad a String With Justification
d.diamonds

Data diamonds
StrAlign

Align Strings To a Specified Character
lines.lm

Add a Linear Regression Line
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
%nin%

Find Matching (or Non-Matching) Elements