Learn R Programming

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

DescTools (version 0.99.16)

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

104,795

Version

0.99.16

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

March 7th, 2016

Functions in DescTools (0.99.16)

CohenD

Cohen's Effect Size
DrawAnnulusSector

Draw a Sector of an Annulus
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
CronbachAlpha

Cronbach's Coefficient Alpha
SetAlpha

Add an Alpha Channel To a Color
Atkinson

Calculate the Atkinson Index
ColToHsv

R Color to HSV Conversion
GetNewXL

Create a new Excel Instance
AUC

Area Under the Curve
Coalesce

Return the First Element Not Being NA
CatTable

Function to write a table
ConDisPairs

Concordant and Discordant Pairs
CollapseTable

Collapse Levels of a Table
AllDuplicated

Index Vector of All Values Involved in Ties
AddMonthsYM

Add a Month to a Date
IsDichotomous

Test If a Variable Contains Only Two Unique Values
DegToRad

Convert Degrees to Radians and vice versa
Assocs

Association Measures
ColorLegend

Add a ColorLegend to a Plot
HuberM

Safe (generalized) Huber M-Estimator of Location
BoxedText

Add Text in a Box to a Plot
BartelsRankTest

Bartels Rank Test
IsDate

Check if an Object is of Type Date
FixToTab

Text to Table
Date Functions

Basic Date Functions
CramerVonMisesTest

Cramer-von Mises test for normality
Dummy

Generate Dummy Codes for a Factor
Closest

Find the Closest Value
CohenKappa

Cohen's Kappa and Weighted Kappa
ConnLines

Add Connection Lines to a Barplot
Format

Format Numbers and Dates
DenseRank

Dense Ranks
BinToDec

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

Canvas for Geometric Plotting
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
LeveneTest

Levene's Test for Homogeneity of Variance
BinTree

Binary Tree
Entropy

Shannon Entropy and Mutual Information
IsValidWrd

Check Word Pointer
ColToHex

Convert a Color into Hex String
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
Clockwise

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

Rao's diversity coefficient also called quadratic entropy
Gmean

Geometric Mean and Standard Deviation
BinomDiffCI

Confidence Interval for a Difference of Binomials
DunnTest

Dunn's Test of Multiple Comparisons
CochranArmitageTest

Cochran-Armitage test for trend
CutQ

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

Create a Date from Numeric Representation
LogLin

Log Linear Hybrid, Generalized Log
Benford

Benford's Distribution
DrawArc

Draw Elliptic or Circular Arc(s)
DrawBezier

Draw a Bezier Curve
Freq

Frequency Table
FindColor

Get Color on a Defined Color Range
Between, Outside

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

Describe Data
CorPolychor

Polychoric Correlation
BreuschGodfreyTest

Breusch-Godfrey Test
KendallTauA

Kendall's Tau-a
PlotFdist

Frequency Distribution Plot
PartCor

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

Parse a SAS Dataline Command
Abind

Combine multi-dimensional arrays
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
PlotCandlestick

Plot Candlestick Chart
DivCoefMax

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

Standard error of mean
GiniSimpson

Compute Gini-Simpson Coefficient
CochranQTest

Cochran's Q test
GCD, LCM

Greatest Common Divisor and Least Common Multiple
GTest

G-Test for Count Data
KappaM

Kappa for m raters
PDFManual

Get PDF Manual Of a Package From CRAN
ParseFormula

Parse a Formula and Create a Model Frame
Factorize

Prime Factorization of Integers
Exec

Execute a Command Given As String
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
PlotLinesA

Plot Lines
DunnettTest

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

Is a Specific Argument in the Dots-Arguments?
PercTable

Percentage Table
KendallTauB

Kendall Tau-b
BoxCox

Box Cox Transformation
BinomCI

Confidence Intervals for Binomial Proportions
ColToRgb

Color to RGB Conversion
ChooseColorDlg

Display Color Dialog to Choose a Color
AxisBreak

Place a Break Mark on an Axis
PlotBubble

Draw a Bubble Plot
Agree

Raw Simple And Extended Percentage Agreement
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
DrawRegPolygon

Draw Regular Polygon(s)
ErrBars

Add Error Bars to an Existing Plot
AddMonths

Add a Month to a Date
AscToChar

Convert ASCII Codes to Characters and Vice Versa
Association measures

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

Add a Legend to a Bubble Plot
CombPairs

Get All Pairs out of one or two Sets of Elements
Datasets for Simulation

Datasets for Simulation
PartitionBy

PartitionBy Evaluates a Function Groupwise
IsEuclid

Is a Distance Matrix Euclidean?
LogSt

Started Logarithmic Transformation and Its Inverse
Extremes

Kth Smallest/Largest Values
HmsToSec

Convert h:m:s To/From Seconds
HexToCol

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

Confusion Matrix And Associated Statistics
IsPrime

IsPrime Property
MHChisqTest

Mantel-Haenszel Chi-Square Test
PlotHorizBar

Plot Horizontal Bars
NemenyiTest

Nemenyi Test
Gini

Gini Coefficient
DrawAnnulus

Draw One or Several Annuli
pRevGumbel

"Reverse" Gumbel Distribution Functions
PlotCirc

Plot Circular Plot
Mode

Mode
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
FisherZ

Fisher r to z and z to r and confidence intervals
LsFct

List Functions of a Package
HotellingsT2Test

Hotelling's T2 Test
Herfindahl

Concentration Measures
PlotBag

PlotBag, a bivariate boxplot
MultinomCI

Confidence Intervals for Multinomial Proportions
PlotECDF

Empirical Cumulative Distribution Function
MosesTest

Moses Test of Extreme Reactions
PostHocTest

Post-Hoc Tests
FindCorr

Determine highly correlated variables
LOCF

Last Observation Carried Forward
Lookup

Look Up a Value In a Reference Vector
PlotVenn

Plot a Venn Diagram
Mar

Set Plot Margins
MoveAvg

Moving Average
Sort

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

Pearson chi-square test for normality
RobRange

Robust Range
Ndec

Count Decimal Places of a Number
NPV

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

Number and Samples for Permutations or Combinations of a Set
Label

Label Attribute of an Object
Midx

Find the Midpoints of a Numeric Vector
WoolfTest

Woolf Test
Logit

Generalized Logit and Inverse Logit function
SelectVarDlg

Select Elements of a Set by Click
SortMixed

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

Siegel-Tukey Test For Equality In Variability
MeanAD

Mean Absolute Deviation From a Center Point
VarCI

Confidence Interval for the Variance
DescTools Palettes

Some Custom Palettes
%c%

Concatenates two strings without any separator.
PlotWeb

Plot a Web of Connected Points
PlotMosaic

Mosaic Plots
EtaSq

Effect size calculations for ANOVAs
HighLow

Return the Lowest and the Highest Values and Their Frequencies
StrPad

Pad a String With Justification
StrVal

Extract All Numeric Values From a String
PlotQQ

QQ-Plot for Any Distribution
LehmacherTest

Lehmacher's Test for Marginal Homogenity
PlotMarDens

Scatterplot with Marginal Densities
RgbToCol

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

Harmonic mean
PlotCorr

Plot a Correlation Matrix
HoeffD

Matrix of Hoeffding's D Statistics
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
Primes

Find all Primes Less Than n
SplitPath

Split Path In Drive, Path, Filename
TheilU

Theil's U index of inequality
ImportFileDlg

Import File In Foreign Format
PlotFun

Plot a Function
RobScale

Robust Scaling With Median and Mad
GetCurrWrd

Get a Handle to a Running Word Instance
PlotPyramid

Draw a Back To Back Pyramid Plot
StrAlign

String Alignment
Stamp

Date/Time/Directory Stamp the Current Plot
StrPos

Find Position of First Occurrence Of a String
identify.formula

Identify Points In a Plot Using a Formula.
reorder.factor

Reorder the Levels of a Factor
TextContrastColor

Choose Textcolor Depending on Background Color
XLGetRange

Import Data Directly From Excel
MixColor

Compute the convex combination of two colors
Rev

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

Recover Original Data From Contingency Table
DurbinWatsonTest

Durbin-Watson Test
RelRisk

Relative Risk
GoodmanKruskalTau

Goodman Kruskal's Tau
Fibonacci

Fibonacci Numbers
KendallW

Kendall's Coefficient of Concordance W
LOF

Local Outlier Factor
GetNewPP

Create a new PowerPoint Instance
SpearmanRho

Spearman Rank Correlation
SetRowNames

Set the Row Names and Column Names in an Object
Vigenere

Vigenere Cypher
Rename

Change Names of a Named Object
Lc

Lorenz Curve
BarnardTest

Barnard's Unconditional Test
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
ClipToVect

Reformat a Table in the Clipboard as Vector
PageTest

Exact Page Test for Ordered Alternatives
WrdText

Insert Normal Text to Word
PlotMultiDens

Plot Multiple Density Curves
ImportDlg

Get Path of a Data File to Be Opened
PlotFaces

Chernoff Faces
MeanCI

Confidence Interval for the Mean
Contrasts

Pairwise Contrasts
WrdPlot

Insert Active Plot to Word
ColPicker

Information plots
VecRot

Vector Rotation
Measures of Shape

Skewness and Kurtosis
CoefVar

Coefficient of Variation
PlotACF

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

Somers' Delta
PlotMatrix

Scatterplot Matrix
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
%nin%

Find Matching (or Non-Matching) Elements
ToWrd

Send Objects to Word
Recode

Recode a Factor
RunsTest

Runs Test for Randomness
Outlier

Outlier
StrDist

Compute Distances Between Strings
SysInfo

System Information And DescTools Options
PlotViolin

Plot Violins Instead of Boxplots
UncertCoef

Uncertainty Coefficient
d.diamonds

Data diamonds
Str

Compactly Display the Structure of an Arbitrary R Object
Ray

Compact Information About the Columns of a Data Frame
StrCap

Capitalize the First Letter of a String
StuartTauC

Stuart $\tau_{c}$
SaveAsDlg

Save R Objects By Choosing a File Interactively
Winsorize

Winsorize
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
StrTrunc

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

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

Count Words in a String
WrdTable

Insert a Table in a Word Document
XLDateToPOSIXct

Convert Excel Dates to POSIXct
ShapiroFranciaTest

Shapiro-Francia test for normality
d.pizza

Data pizza
WrdInsertBookmark

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

Does a String Contain Only Numeric Data
XLView

Use Excel as Viewer for a Data.Frame
PlotArea

Create an Area Plot
YuenTTest

Yuen t-Test For Trimmed Means
d.countries

ISO 3166-1 Country Codes
WrdParagraphFormat

Get or Set the Paragraph Format in Word
ToLong, ToWide

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

Odds Ratio Estimation and Confidence Intervals
PlotTernary

Ternary or Triangular Plots.
ZeroIfNA

Replace NAs by 0
lines.loess

Add a Loess or a Spline Smoother
SmoothSpline

Formula Interface For smooth.spline
RoundTo

Round to Multiple
StrRev

Reverse a String
DrawEllipse

Draw an Ellipse
TOne

Create Table One Describing Baseline Characteristics
TextToTable

Converts String To a Table
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
WrdCaption

Insert Caption to Word
Rotate

Rotate a Geometric Structure
UnitConv

Unit Conversion
Zodiac

Calculate the Zodiac of a Date
day.name

Build-in Constants Extension
PlotDot

Cleveland's Dot Plots
WrdStyle

Get or Set the Style in Word
WrdR

Insert a R Command and It's Output in a Word Document
Xplore

Interactive Graphical Data Explorer
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
d.whisky

Classification of Scotch Single Malts
CCC

Concordance Correlation Coefficient
Keywords

List Keywords For R Manual Pages
Some numeric checks

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

Word VBA constants
GetNewWrd

Create a new Word Instance
HexToRgb

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

(Robust) Jarque Bera Test
HodgesLehmann

Hodges-Lehmann Estimator of Location
GoodmanKruskalGamma

Goodman Kruskal's Gamma
PasswordDlg

Password Dialog
DrawCircle

Draw a Circle
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
d.periodic

Periodic Table of Elements
as.matrix.xtabs

Convert xtabs To matrix
Lambda

Goodman Kruskal Lambda
MedianCI

Confidence Interval for the Median
MeanDiffCI

Confidence Interval For Difference of Means
LinScale

Perform a linear scaling of x
PlotPolar

Plot Values on a Circular Grid
PlotTreemap

Create a Treemap
lines.lm

Add a Linear Regression Line
VarTest

ChiSquare Test for One Variance and F Test to Compare Two Variances
split.formula

Formula Interface for Split
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
ColToGrey

Convert Colors to Grey/Grayscale
FctArgs

Retrieve a Function's Arguments
IsOdd

Checks If An Integer Is Even Or Odd
PairApply

Pairwise Calculations
PlotMiss

Plot Missing Data
RndPairs

Create Pairs of Correlated Random Numbers
PolarGrid

Plot a Grid in Polar Coordinates
SampleTwins

Sample Twins
SignTest

Sign Test
StrAbbr

String Abbreviation
WrdFont

Get or Set the Font in Word
ZTest

Z Test for Known Population Standard Deviation
StrTrim

Remove Leading/Trailing Whitespace From A String
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
DoCall

Fast Alternative To The Internal do.call
DrawBand

Draw Confidence Band
ExpFreq

Expected frequencies
Frac

Fractional Part and Maximal Digits of a Numeric Value
PoissonCI

Poisson Confidence Interval
ICC

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

Point in Polygon
Recycle

Recyle a List of Elements
StrLeft, StrRight

Returns the Left Or the Right Part Of a String
Strata

Stratified sampling
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
Trim

Trim a Vector
%like%

Like operator
median.factor

Median for Ordered Factors
power.chisq.test

Power Calculations for ChiSquared Tests