Learn R Programming

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

DescTools (version 0.99.15)

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.15

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

October 25th, 2015

Functions in DescTools (0.99.15)

CronbachAlpha

Cronbach's Coefficient Alpha
DegToRad

Convert Degrees to Radians and vice versa
BinomDiffCI

Confidence Interval for a Difference of Binomials
DivCoef

Rao's diversity coefficient also called quadratic entropy
Gini

Gini Coefficient
Herfindahl

Concentration Measures
AUC

Area Under the Curve
LogLin

Log Linear Hybrid, Generalized Log
Coalesce

Return the First Element Not Being NA
MHChisqTest

Mantel-Haenszel Chi-Square Test
GoodmanKruskalGamma

Goodman Kruskal's Gamma
BubbleLegend

Add a Legend to a Bubble Plot
Gmean

Geometric Mean and Standard Deviation
PageTest

Exact Page Test for Ordered Alternatives
Conf

Confusion Matrix And Associated Statistics
Factorize

Prime Factorization of Integers
FisherZ

Fisher r to z and z to r and confidence intervals
ColToGrey

Convert Colors to Grey/Grayscale
BoxCox

Box Cox Transformation
PlotBubble

Draw a Bubble Plot
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
HighLow

Return the Lowest and the Highest Values and Their Frequencies
BartelsRankTest

Bartels Rank Test
PlotDesc

Display descriptive plots
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
PlotViolin

Plot Violins Instead of Boxplots
ChooseColorDlg

Display Color Dialog to Choose a Color
Extremes

Kth Smallest/Largest Values
SetAlpha

Add an Alpha Channel To a Color
ConDisPairs

Concordant and Discordant Pairs
DrawRegPolygon

Draw Regular Polygon(s)
Contrasts

Pairwise Contrasts
HexToRgb

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

Import File In Foreign Format
AddMonths

Add a Month to a Date
Desc

Describe Data
Desc.Date

Describe a Date Vector
DrawBand

Draw Confidence Band
DoCall

Fast Alternative To The Internal do.call
Desc.integer

Describe an integer variable
Agree

Raw Simple And Extended Percentage Agreement
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
AscToChar

Convert ASCII Codes to Characters and Vice Versa
ICC

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

Combine multi-dimensional arrays
NemenyiTest

Nemenyi Test
Closest

Find the Closest Value
Str

Compactly Display the Structure of an Arbitrary R Object
Between, Outside

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

Capitalize the First Letter of a String
CoefVar

Coefficient of Variation
PlotCirc

Plot Circular Plot
DrawCircle

Draw a Circle
CombPairs

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

Draw a Back To Back Pyramid Plot
PlotFaces

Chernoff Faces
LinScale

Perform a linear scaling of x
Fibonacci

Fibonacci Numbers
Benford

Benford's Distribution
PartCor

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

Mean Absolute Deviation From a Center Point
CohenD

Cohen's Effect Size
CatTable

Function to write a table
DrawArc

Draw Elliptic or Circular Arc(s)
CCC

Concordance Correlation Coefficient
Canvas

Canvas for Geometric Plotting
PlotHorizBar

Plot Horizontal Bars
Desc.table

Describe a n-dimensional Contingency Table
Freq

Frequency Table
Ndec

Count Decimal Places of a Number
PoissonCI

Poisson Confidence Interval
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
ColToHsv

R Color to HSV Conversion
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
Hmean

Harmonic mean
FindColor

Get Color on a Defined Color Range
Association measures

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

Generate Dummy Codes for a Factor
MosesTest

Moses Test of Extreme Reactions
BarnardTest

Barnard's Unconditional Test
BinToDec

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

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

Identify Points in Plot Lying within a Rectangle or Polygon
Untable

Recover Original Data From Contingency Table
Assocs

Association Measures
DrawAnnulusSector

Draw a Sector of an Annulus
BinomCI

Confidence Intervals for Binomial Proportions
Lc

Lorenz Curve
PolarGrid

Plot a Grid in Polar Coordinates
PlotFun

Plot a Function
ColToRgb

Color to RGB Conversion
Mode

Mode
Atkinson

Calculate the Atkinson Index
BoxedText

Add Text in a Box to a Plot
Ray

Compact Information About the Columns of a Data Frame
Date

Create a Date from Numeric Representation
PlotCorr

Plot a Correlation Matrix
EtaSq

Effect size calculations for ANOVAs
PlotWeb

Plot a Web of Connected Points
ParseSASDatalines

Parse a SAS Dataline Command
DenseRank

Dense Ranks
Permn

Number and Samples for Permutations or Combinations of a Set
Frac

Fractional Part and Maximal Digits of a Numeric Value
Recycle

Recyle a List of Elements
CutQ

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

Plot Candlestick Chart
DescWrd

Use Word as Reporting Tool for Describing Data
LeveneTest

Levene's Test for Homogeneity of Variance
IsOdd

Checks If An Integer Is Even Or Odd
PtInPoly

Point in Polygon
RobScale

Robust Scaling With Median and Mad
Desc.logical

Describe a dichotomous variable
VarCI

Confidence Interval for the Variance
PlotBag

PlotBag, a bivariate boxplot
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
RoundM

Round to Multiple
CorPolychor

Polychoric Correlation
DunnTest

Dunn's Test of Multiple Comparisons
ConnLines

Add Connection Lines to a Barplot
RobRange

Robust Range
DunnettTest

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

Converts String To a Table
HuberM

Safe (generalized) Huber M-Estimator of Location
Desc.data.frame

Describe a data.frame Or a List
HmsToSec

Convert h:m:s To/From Seconds
HotellingsT2Test

Hotelling's T2 Test
GetNewWrd

Create a new Word Instance
DurbinWatsonTest

Durbin-Watson Test
KappaM

Kappa for m raters
HodgesLehmann

Hodges-Lehmann Estimator of Location
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
MeanSE

Standard error of mean
PercTable

Percentage Table
LehmacherTest

Lehmacher's Test for Marginal Homogenity
ErrBars

Add Error Bars to an Existing Plot
SmoothSpline

Formula Interface For smooth.spline
Entropy

Shannon Entropy and Mutual Information
Outlier

Outlier
GiniSimpson

Compute Gini-Simpson Coefficient
JarqueBeraTest

(Robust) Jarque Bera Test
Desc.flags

Describe a Set of Dichotomous Variables
CohenKappa

Cohen's Kappa and Weighted Kappa
reorder.factor

Reorder the Levels of a Factor
SaveAsDlg

Save R Objects By Choosing a File Interactively
Some numeric checks

Check a Vector For Being Numeric, Zero Or a Whole Number
GCD, LCM

Greatest Common Divisor and Least Common Multiple
TheilU

Theil's U index of inequality
ShapiroFranciaTest

Shapiro-Francia test for normality
GetNewXL

Create a new Excel Instance
Exec

Execute a Command Given As String
StrDist

Compute Distances Between Strings
Logit

Generalized Logit and Inverse Logit function
Vigenere

Vigenere Cypher
StrAbbr

String Abbreviation
Format

Format Numbers and Dates
WoolfTest

Woolf Test
Desc.formula

Describe Variables by Groups
Lambda

Goodman Kruskal Lambda
XLDateToPOSIXct

Convert Excel Dates to POSIXct
DescTools Palettes

Some Custom Palettes
CochranArmitageTest

Cochran-Armitage test for trend
PlotDot

Cleveland's Dot Plots
Desc.factor

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

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

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

Test If a Variable Contains Only Two Unique Values
LsFct

List Functions of a Package
Winsorize

Winsorize
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
PlotMarDens

Scatterplot with Marginal Densities
Midx

Find the Midpoints of a Numeric Vector
PlotMosaic

Mosaic Plots
Desc.numeric

Describe a numeric vector
StrVal

Extract All Numeric Values From a String
IsEuclid

Is a Distance Matrix Euclidean?
PlotMultiDens

Plot Multiple Density Curves
KendallW

Kendall's Coefficient of Concordance W
%c%

Concatenates two strings without any separator.
YuenTTest

Yuen t-Test For Trimmed Means
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
ImportDlg

Get Path of a Data File to Be Opened
PlotTreemap

Create a Treemap
GTest

G-Test for Count Data
FctArgs

Retrieve a Functions' Arguments
IsValidWrd

Check Word Pointer
MoveAvg

Moving Average
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
PlotLinesA

Plot Lines
ZTest

Z Test for Known Population Standard Deviation
VecRot

Vector Rotation
Mar

Set Plot Margins
SelectVarDlg

Select Elements of a Set by Click
PlotTernary

Ternary or Triangular Plots.
LogSt

Started Logarithmic Transformation and Its Inverse
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
PairApply

Pairwise Calculations
HoeffD

Matrix of Hoeffding's D Statistics
%like%

Like operator
MixColor

Compute the convex combination of two colors
Rev

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

Confidence Intervals for Multinomial Proportions
PlotVenn

Plot a Venn Diagram
StrIsNumeric

Does a String Contain Only Numeric Data
PostHocTest

Post-Hoc Tests
WrdText

Insert Normal Text to Word
SomersDelta

Somers' Delta
PartitionBy

PartitionBy Evaluates a Function Groupwise
MeanDiffCI

Confidence Interval For Difference of Means
RunsTest

Runs Test for Randomness
Xplore

Interactive Graphical Data Explorer
SignTest

Sign Test
PlotECDF

Empirical Cumulative Distribution Function
day.name

Build-in Constants Extension
Measures of Shape

Skewness and Kurtosis
XLGetRange

Import Data Directly From Excel
IsDate

Check if an Object is of Type Date
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
PlotQQ

QQ-Plot for Any Distribution
Rename

Change Names of a Named Object
Sort

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

Remove Leading/Trailing Whitespace From A String
MedianCI

Confidence Interval for the Median
StuartTauC

Stuart $\tau_{c}$
PearsonTest

Pearson chi-square test for normality
MeanCI

Confidence Interval for the Mean
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
PlotMatrix

Scatterplot Matrix
TextContrastColor

Choose Textcolor Depending on Background Color
d.countries

ISO 3166-1 Country Codes
SetRowNames

Set the Row Names and Column Names in an Object
Recode

Recode a Factor
WrdSetFont

Set the Font in Word
UncertCoef

Uncertainty Coefficient
TOne

Create Table One Describing Baseline Characteristics
Strata

Stratified sampling
WrdInsTab

Insert a Table in a Word Document
WrdCaption

Insert Caption to Word
WrdTable

Produces a Table in Word
Stamp

Date/Time/Directory Stamp the Current Plot
SortMixed

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

Information plots
StrAlign

Align Strings To a Specified Character
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
RndPairs

Create Pairs of Correlated Random Numbers
power.chisq.test

Power Calculations for ChiSquared Tests
StrCountW

Count Words in a String
median.factor

Median for Ordered Factors
SampleTwins

Sample Twins
Trim

Trim a Vector
d.pizza

Data pizza
Zodiac

Calculate the Zodiac of a Date
split.formula

Formula Interface for Split
SplitPath

Split Path In Drive, Path, Filename
wdConst

Word VBA constants
StrPad

Pad a String With Justification
identify.formula

Identify Points In a Plot Using a Formula.
StrLeft, StrRight

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

Unit Conversion
ToLong, ToWide

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

Replace NAs by 0
d.whisky

Classification of Scotch Single Malts
lines.loess

Add a Loess or a Spline Smoother
lines.lm

Add a Linear Regression Line
d.periodic

Periodic Table of Elements
AllDuplicated

Index Vector of All Values Involved in Ties
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
ColToHex

Convert a Color into Hex String
CramerVonMisesTest

Cramer-von Mises test for normality
Date Functions

Basic Date Functions
DivCoefMax

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

Draw a Bezier Curve
KendallTauB

Kendall tau-b
LOF

Local Outlier Factor
Label

Label Attribute of an Object
PlotFdist

Frequency Distribution Plot
Primes

Find all Primes Less Than n
Rotate

Rotate a Geometric Structure
pRevGumbel

"Reverse" Gumbel Distribution Functions
StrChop

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

Find Position of First Occurrence Of a String
as.matrix.xtabs

Convert xtabs To matrix
d.diamonds

Data diamonds
BinTree

Binary Tree
CochranQTest

Cochran's Q test
ExpFreq

Expected frequencies
FindCorr

Determine highly correlated variables
InDots

Is a Specific Argument in the Dots-Arguments?
Keywords

List Keywords For R Manual Pages
LOCF

Last Observation Carried Forward
PlotArea

Create an Area Plot
WrdPlot

Insert Active Plot to Word
%nin%

Find Matching (or Non-Matching) Elements
AxisBreak

Place a Break Mark on an Axis
ClipToVect

Reformat a Table in the Clipboard as Vector
ColorLegend

Add a ColorLegend to a Plot
CollapseTable

Collapse Levels of a Table
GoodmanKruskalTauA

Goodman Kruskal's Tau a
GetCurrWrd

Get a Handle to a Running Word Instance
HexToCol

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

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

Plot Values on a Circular Grid
PlotMiss

Plot Missing Data
RelRisk

Relative Risk
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
WrdInsertBookmark

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

Draw One or Several Annuli
DrawEllipse

Draw an Ellipse
FixToTab

Text to Table
IsPrime

IsPrime Property
GetNewPP

Create a new PowerPoint Instance
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PDFManual

Get PDF Manual Of a Package From CRAN
ParseFormula

Parse a Formula and Create a Model Frame
PasswordDlg

Password Dialog
PlotACF

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

Plot Monthly or Seasonal Effects Of a Univariate Time Series
RgbToCol

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

Spearman Rank Correlation
StrRev

Reverse a String
SysInfo

System Information And DescTools Options
XLView

Use Excel as Viewer for a Data.Frame