Learn R Programming

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

DescTools (version 0.99.18)

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

97,236

Version

0.99.18

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

November 4th, 2016

Functions in DescTools (0.99.18)

AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
Between, Outside

Operators To Check, If a Value Lies Within Or Outside a Given Range
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
Assocs

Association Measures
Atkinson

Calculate the Atkinson Index
AUC

Area Under the Curve
Benford

Benford's Distribution
AxisBreak

Place a Break Mark on an Axis
BartelsRankTest

Bartels Rank Test
AscToChar

Convert ASCII Codes to Characters and Vice Versa
BinomDiffCI

Confidence Interval for a Difference of Binomials
Asp

Aspect Ratio
BoxedText

Add Text in a Box to a Plot
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
BoxCox

Box Cox Transformation
BinToDec

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

Breusch-Godfrey Test
BrierScore

Brier Score
BinomCI

Confidence Intervals for Binomial Proportions
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
CCC

Concordance Correlation Coefficient
BinTree

Binary Tree
BubbleLegend

Add a Legend to a Bubble Plot
ChooseColorDlg

Display Color Dialog to Choose a Color
Closest

Find the Closest Value
Canvas

Canvas for Geometric Plotting
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
Coalesce

Return the First Element Not Being NA
CatTable

Function to write a table
ClipToVect

Reformat a Table in the Clipboard as Vector
Clockwise

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

Convert a Color into Hex String
CollapseTable

Collapse Levels of a Table
CohenD

Cohen's Effect Size
ColToGrey

Convert Colors to Grey/Grayscale
ColToHsv

R Color to HSV Conversion
ColToRgb

Color to RGB Conversion
ColorLegend

Add a ColorLegend to a Plot
ColPicker

Plot All Named R Colors
CochranArmitageTest

Cochran-Armitage test for trend
CochranQTest

Cochran's Q test
CorPart

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

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

ColumnWrap
CorPolychor

Polychoric Correlation
Contrasts

Pairwise Contrasts
ConDisPairs

Concordant and Discordant Pairs
ConnLines

Add Connection Lines to a Barplot
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
Cstat

C Statistic (Area Under the ROC Curve)
DoCall

Fast Alternative To The Internal do.call
CutQ

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

Draw Confidence Band
DrawBezier

Draw a Bezier Curve
DrawArc

Draw Elliptic or Circular Arc(s)
FileOpenCmd

Get Path of a Data File to Be Opened
FindColor

Get Color on a Defined Color Range
DescToolsOptions

DescTools Options
DigitSum

Calculate Digit Sum
DurbinWatsonTest

Durbin-Watson Test
Entropy

Shannon Entropy and Mutual Information
ErrBars

Add Error Bars to an Existing Plot
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
GCD, LCM

Greatest Common Divisor and Least Common Multiple
KendallTauB

Kendall Tau-b
GeomTrans

Geometric Transformations
KendallW

Kendall's Coefficient of Concordance W
Agree

Raw Simple And Extended Percentage Agreement
AddMonthsYM

Add a Month to a Date
d.whisky

Classification of Scotch Single Malts
Desc

Describe Data
Datasets for Simulation

Datasets for Probabilistic Simulation
DunnettTest

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

Dense Ranks
FindCorr

Determine highly correlated variables
DunnTest

Dunn's Test of Multiple Comparisons
FixToTab

Text to Table
Cor

Correlation, Variance and Covariance (Matrices)
AllDuplicated

Index Vector of All Values Involved in Ties
d.periodic

Periodic Table of Elements
DivCoef

Rao's diversity coefficient also called quadratic entropy
d.pizza

Data pizza
DivCoefMax

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

Generate Dummy Codes for a Factor
DrawRegPolygon

Draw Regular Polygon(s)
Factorize

Prime Factorization of Integers
ExpFreq

Expected frequencies
Abstract

Abstract
Abind

Combine Multidimensional Arrays
Date Functions

Basic Date Functions
Date

Create a Date from Numeric Representation
DrawCircle

Draw a Circle
EtaSq

Effect size calculations for ANOVAs
DrawEllipse

Draw an Ellipse
Exec

Execute a Command Given As String
GetNewPP

Create a new PowerPoint Instance
GTest

G-Test for Count Data
HexToCol

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

Get HWZ Datasets
ICC

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

Test If a Variable Contains Only Two Unique Values
IsDate

Check if an Object is of Type Date
median.factor

Median for Ordered Factors
MeanDiffCI

Confidence Interval For Difference of Means
MoveAvg

Moving Average
MosesTest

Moses Test of Extreme Reactions
Gini

Gini Coefficient
GetNewXL

Create a new Excel Instance
HexToRgb

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

Harmonic Mean and Its Confidence Interval
InDots

Is a Specific Argument in the Dots-Arguments?
ImportFileDlg

Import File In Foreign Format
IsEuclid

Is a Distance Matrix Euclidean?
Keywords

List Keywords For R Manual Pages
IsOdd

Checks If An Integer Is Even Or Odd
Label, Unit

Label, Unit Attribute of an Object
AddClass

Add and Remove Classes From an Object
AddMonths

Add a Month to a Date
d.countries

ISO 3166-1 Country Codes
d.diamonds

Data diamonds
FctArgs

Retrieve a Function's Arguments
day.name

Build-in Constants Extension
DegToRad

Convert Degrees to Radians and vice versa
Fibonacci

Fibonacci Numbers
Frac

Fractional Part and Maximal Digits of a Numeric Value
Freq

Frequency Table
HmsToSec

Convert h:m:s To/From Seconds
HodgesLehmann

Hodges-Lehmann Estimator of Location
HotellingsT2Test

Hotelling's T2 Test
HuberM

Safe (generalized) Huber M-Estimator of Location
KappaM

Kappa for m raters
GetNewWrd

Create a new Word Instance
Lc

Lorenz Curve
KendallTauA

Kendall's Tau-a
GoodmanKruskalGamma

Goodman Kruskal's Gamma
GoodmanKruskalTau

Goodman Kruskal's Tau
HoeffD

Matrix of Hoeffding's D Statistics
HosmerLemeshowTest

Hosmer-Lemeshow Goodness of Fit Tests
Some numeric checks

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

Started Logarithmic Transformation and Its Inverse
Lookup

Look Up a Value In a Reference Vector
%nin%

Find Matching (or Non-Matching) Elements
MedianCI

Confidence Interval for the Median
Median

Median Value
PartitionBy

PartitionBy Evaluates a Function Groupwise
OddsRatio

Odds Ratio Estimation and Confidence Intervals
lines.lm

Add a Linear Regression Line
MHChisqTest

Mantel-Haenszel Chi-Square Test
lines.loess

Add a Loess or a Spline Smoother
PoissonCI

Poisson Confidence Interval
Midx

Find the Midpoints of a Numeric Vector
Rename

Change Names of a Named Object
PolarGrid

Plot a Grid in Polar Coordinates
reorder.factor

Reorder the Levels of a Factor
Rotate

Rotate a Geometric Structure
PasswordDlg

Password Dialog
Permn

Number and Samples for Permutations or Combinations of a Set
PlotACF

Combined Plot of a Time Series and its ACF and PACF
PlotDot

Cleveland's Dot Plots
PlotECDF

Empirical Cumulative Distribution Function
PlotMatrix

Scatterplot Matrix
JarqueBeraTest

(Robust) Jarque Bera Test
PlotMiss

Plot Missing Data
Lambda

Goodman Kruskal Lambda
Extremes

Kth Smallest/Largest Values
LOCF

Last Observation Carried Forward
LOF

Local Outlier Factor
MeanAD

Mean Absolute Deviation From a Center Point
MeanCI

Confidence Interval for the Mean
RoundTo

Round to Multiple
Measures of Shape

Skewness and Kurtosis
SignTest

Sign Test
SysInfo

System Information
StrPos

Find Position of First Occurrence Of a String
StrPad

Pad a String With Justification
TextContrastColor

Choose Textcolor Depending on Background Color
ToLong, ToWide

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

Post-Hoc Tests
power.chisq.test

Power Calculations for ChiSquared Tests
Recycle

Recyle a List of Elements
RndPairs

Create Pairs of Correlated Random Numbers
RelRisk

Relative Risk
RgbToCol

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

Set the Row Names and Column Names in an Object
Shade

Produce a Shaded Curve
LehmacherTest

Lehmacher's Test for Marginal Homogenity
Logit

Generalized Logit and Inverse Logit function
LogLin

Log Linear Hybrid, Generalized Log
Mar

Set Plot Margins
ORToRelRisk

Transform Odds Ratio to Relative Risk
Mean

Arithmetic Mean
ToWrd

Send Objects to Word
Outlier

Outlier
WrdFormatCells

Format Cells Of a Word Table
WrdInsertBookmark

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

Use Excel as Viewer for a Data.Frame
Xplore

Interactive Graphical Data Explorer
YuenTTest

Yuen t-Test For Trimmed Means
ZeroIfNA

Replace NAs by 0
SortMixed

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

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

Capitalize the First Letter of a String
Strata

Stratified sampling
StuartTauC

Stuart $Tau C$
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
Untable

Recover Original Data From Contingency Table
VarCI

Confidence Interval for the Variance
PairApply

Pairwise Calculations
DescTools Palettes

Some Custom Palettes
PearsonTest

Pearson chi-square test for normality
PlotMarDens

Scatterplot with Marginal Densities
PercTable

Percentage Table
PlotLog

Logarithmic Plot
PlotPch

Information plots
PlotMultiDens

Plot Multiple Density Curves
PlotArea

Create an Area Plot
PlotBag

PlotBag, a bivariate boxplot
PlotCirc

Plot Circular Plot
PlotCorr

Plot a Correlation Matrix
PlotQQ

QQ-Plot for Any Distribution
PlotTernary

Ternary or Triangular Plots.
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
pRevGumbel

"Reverse" Gumbel Distribution Functions
Rev

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

Standard Deviation
WoolfTest

Woolf Test
WrdCaption

Insert Caption to Word
XLDateToPOSIXct

Convert Excel Dates to POSIXct
XLGetRange

Import Data Directly From Excel
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
StrAbbr

String Abbreviation
Primes

Find all Primes Less Than n
StrTrunc

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

Extract All Numeric Values From a String
StrAlign

String Alignment
TMod

Comparison Table For Linear Models
TOne

Create Table One Describing Baseline Characteristics
VIF

Variance Inflation Factors
Vigenere

Vigenere Cypher
WrdParagraphFormat

Get or Set the Paragraph Format in Word
WrdMergeCells

Merges Cells Of a Defined Word Table Range
ZTest

Z Test for Known Population Standard Deviation
Zodiac

Calculate the Zodiac of a Date
NemenyiTest

Nemenyi Test
MultinomCI

Confidence Intervals for Multinomial Proportions
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
PageTest

Exact Page Test for Ordered Alternatives
%c%

Concatenates two strings without any separator.
PDFManual

Get PDF Manual Of a Package From CRAN
Arrow

Insert an Arrow
Gmean

Geometric Mean and Standard Deviation
as.matrix.xtabs

Convert xtabs To matrix
GiniSimpson

Compute Gini-Simpson Coefficient
identify.formula

Identify Points In a Plot Using a Formula.
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
IsPrime

IsPrime Property
IsValidWrd

Check Word Pointer
LeveneTest

Levene's Test for Homogeneity of Variance
%like%

Like operator
SelectVarDlg

Select Elements of a Set by Click
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
SetAlpha

Add an Alpha Channel To a Color
StrRep

Repeat the Elements of a Character Vector
SplitPath

Split Path In Drive, Path, Filename
StrRev

Reverse a String
StrLeft, StrRight

Returns the Left Or the Right Part Of a String
PlotFaces

Chernoff Faces
PlotFdist

Frequency Distribution Plot
PlotPolar

Plot Values on a Circular Grid
PlotPyramid

Draw a Back To Back Pyramid Plot
PlotTreemap

Create a Treemap
PseudoR2

Pseudo R2 Statistics
PlotVenn

Plot a Venn Diagram
PtInPoly

Point in Polygon
RobScale

Robust Scaling With Median and Mad
RomanToInt

Convert Roman Numerals to Integers
ShapiroFranciaTest

Shapiro-Francia test for normality
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
SpearmanRho

Spearman Rank Correlation
StrChop

Split a String in a Number of Pieces With Fixed Length
split.formula

Formula Interface for Split
Trim

Trim a Vector
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
StrDist

Compute Distances Between Strings
WrdTable

Insert a Table in a Word Document
WrdTableBorders

Draw Borders to a Word Table
LineToUser

Convert Line Coordinates To User Coordinates
LinScale

Perform a linear scaling of x
List Variety Of Objects

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

Measures of Accuracy
ParseFormula

Parse a Formula and Create a Model Frame
MixColor

Compute the convex combination of two colors
ParseSASDatalines

Parse a SAS Dataline Command
Mode

Mode
PlotBubble

Draw a Bubble Plot
PlotCandlestick

Plot Candlestick Chart
PlotFun

Plot a Function
PlotLinesA

Plot Lines
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
PlotMosaic

Mosaic Plots
Range

(Robust) Range
PlotViolin

Plot Violins Instead of Boxplots
Recode

Recode a Factor
PlotWeb

Plot a Web of Connected Points
SampleTwins

Sample Twins
SaveAsDlg

Save R Objects By Choosing a File Interactively
SmoothSpline

Formula Interface For smooth.spline
Some

Return Some Randomly Chosen Elements of an Object
Stamp

Date/Time/Directory Stamp the Current Plot
Str

Compactly Display the Structure of an Arbitrary R Object
TextToTable

Converts String To a Table
StrExtract

Extract Part of a String
TheilU

Theil's U index of inequality
StrIsNumeric

Does a String Contain Only Numeric Data
Winsorize

Winsorize
wdConst

Word VBA constants
WrdStyle

Get or Set the Style in Word
WrdPlot

Insert Active Plot to Word
StrTrim

Remove Leading/Trailing Whitespace From A String
VarTest

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

Get or Set the Font in Word
VecRot

Vector Rotation
WrdCellRange

Return the Cell Range Of a Word Table