Learn R Programming

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

DescTools (version 0.99.14)

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

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

October 11th, 2015

Functions in DescTools (0.99.14)

Desc.formula

Describe Variables by Groups
SetAlpha

Add an Alpha Channel To a Color
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
Desc.integer

Describe an integer variable
ConnLines

Add Connection Lines to a Barplot
BoxCox

Box Cox Transformation
DoCall

Fast Alternative To The Internal do.call
Clockwise

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

Combine multi-dimensional arrays
LogLin

Log Linear Hybrid, Generalized Log
Contrasts

Pairwise Contrasts
Gmean

Geometric Mean and Standard Deviation
AxisBreak

Place a Break Mark on an Axis
Desc.factor

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

Fibonacci Numbers
GetCurrWrd

Get a Handle to a Running Word Instance
CramerVonMisesTest

Cramer-von Mises test for normality
DrawRegPolygon

Draw Regular Polygon(s)
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
AddMonths

Add a Month to a Date
ColorLegend

Add a ColorLegend to a Plot
AscToChar

Convert ASCII Codes to Characters and Vice Versa
Format

Format Numbers and Dates
DivCoefMax

Maximal value of Rao's diversity coefficient also called quadratic entropy
Between, Outside

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

Raw Simple And Extended Percentage Agreement
EtaSq

Effect size calculations for ANOVAs
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
ColToHsv

R Color to HSV Conversion
DrawArc

Draw Elliptic or Circular Arc(s)
BinomCI

Confidence Intervals for Binomial Proportions
ExpFreq

Expected frequencies
NemenyiTest

Nemenyi Test
Assocs

Association Measures
CCC

Concordance Correlation Coefficient
Frac

Fractional Part and Maximal Digits of a Numeric Value
Atkinson

Calculate the Atkinson Index
CatTable

Function to write a table
PlotVenn

Plot a Venn Diagram
IsPrime

IsPrime Property
Desc.Date

Describe a Date Vector
PlotCorr

Plot a Correlation Matrix
Canvas

Canvas for Geometric Plotting
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
BubbleLegend

Add a Legend to a Bubble Plot
Association measures

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

Draw One or Several Annuli
Entropy

Shannon Entropy and Mutual Information
ClipToVect

Reformat a Table in the Clipboard as Vector
LehmacherTest

Lehmacher's Test for Marginal Homogenity
reorder.factor

Reorder the Levels of a Factor
DrawEllipse

Draw an Ellipse
MHChisqTest

Mantel-Haenszel Chi-Square Test
Desc.data.frame

Describe a data.frame Or a List
RelRisk

Relative Risk
Desc.numeric

Describe a numeric vector
ICC

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

Breslow-Day Test for Homogeneity of the Odds Ratios
ColToRgb

Color to RGB Conversion
SplitPath

Split Path In Drive, Path, Filename
CollapseTable

Collapse Levels of a Table
Exec

Execute a Command Given As String
GetNewPP

Create a new PowerPoint Instance
IsEuclid

Is a Distance Matrix Euclidean?
ParseFormula

Parse a Formula and Create a Model Frame
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
Closest

Find the Closest Value
AllDuplicated

Index Vector of All Values Involved in Ties
ConDisPairs

Concordant and Discordant Pairs
Coalesce

Return the First Element Not Being NA
PDFManual

Get PDF Manual Of a Package From CRAN
SampleTwins

Sample Twins
DrawCircle

Draw a Circle
PlotPyramid

Draw a Back To Back Pyramid Plot
Date

Create a Date from Numeric Representation
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
Mode

Mode
BinToDec

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

Cohen's Kappa and Weighted Kappa
CorPolychor

Polychoric Correlation
RgbToCol

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

Date/Time/Directory Stamp the Current Plot
BoxedText

Add Text in a Box to a Plot
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
PlotMatrix

Scatterplot Matrix
PlotACF

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

Dense Ranks
Benford

Benford's Distribution
BartelsRankTest

Bartels Rank Test
GCD, LCM

Greatest Common Divisor and Least Common Multiple
PlotHorizBar

Plot Horizontal Bars
DegToRad

Convert Degrees to Radians and vice versa
BinomDiffCI

Confidence Interval for a Difference of Binomials
CombPairs

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

Describe Data
FindCorr

Determine highly correlated variables
ChooseColorDlg

Display Color Dialog to Choose a Color
DrawAnnulusSector

Draw a Sector of an Annulus
Mar

Set Plot Margins
DurbinWatsonTest

Durbin-Watson Test
LinScale

Perform a linear scaling of x
StrPad

Pad a String With Justification
ImportDlg

Get Path of a Data File to Be Opened
Ndec

Count Decimal Places of a Number
PlotTernary

Ternary or Triangular Plots.
PlotMarDens

Scatterplot with Marginal Densities
CronbachAlpha

Cronbach's Coefficient Alpha
Desc.flags

Describe a Set of Dichotomous Variables
Date Functions

Basic Date Functions
PlotMiss

Plot Missing Data
Rename

Change Names of a Named Object
Dummy

Generate Dummy Codes for a Factor
PlotBag

PlotBag, a bivariate boxplot
CoefVar

Coefficient of Variation
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
HotellingsT2Test

Hotelling's T2 Test
MixColor

Compute the convex combination of two colors
LogSt

Started Logarithmic Transformation and Its Inverse
PtInPoly

Point in Polygon
ErrBars

Add Error Bars to an Existing Plot
IsDate

Check if an Object is of Type Date
GetNewWrd

Create a new Word Instance
Herfindahl

Concentration Measures
Desc.table

Describe a n-dimensional Contingency Table
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
HexToRgb

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

Draw Confidence Band
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
ColToGrey

Convert Colors to Grey/Grayscale
MeanDiffCI

Confidence Interval For Difference of Means
HuberM

Safe (generalized) Huber M-Estimator of Location
Rotate

Rotate a Geometric Structure
HmsToSec

Convert h:m:s To/From Seconds
JarqueBeraTest

(Robust) Jarque Bera Test
Label

Label Attribute of an Object
Conf

Confusion Matrix And Associated Statistics
StrTrunc

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

Binary Tree
MeanSE

Standard error of mean
MeanCI

Confidence Interval for the Mean
PearsonTest

Pearson chi-square test for normality
MultinomCI

Confidence Intervals for Multinomial Proportions
LOCF

Last Observation Carried Forward
FisherZ

Fisher r to z and z to r and confidence intervals
Some numeric checks

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

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

Insert Normal Text to Word
SaveAsDlg

Save R Objects By Choosing a File Interactively
day.name

Build-in Constants Extension
Extremes

Kth Smallest/Largest Values
FixToTab

Text to Table
KendallTauB

Kendall tau-b
%like%

Like operator
PageTest

Exact Page Test for Ordered Alternatives
GoodmanKruskalTauA

Goodman Kruskal's Tau a
Keywords

List valid Keywords for R man pages
Hmean

Harmonic mean
CochranQTest

Cochran's Q test
LOF

Local Outlier Factor
Outlier

Outlier
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
Factorize

Prime Factorization of Integers
IsDichotomous

Test If a Variable Contains Only Two Unique Values
PercTable

Percentage Table
Midx

Find the Midpoints of a Numeric Vector
Logit

Generalized Logit and Inverse Logit function
GiniSimpson

Compute Gini-Simpson Coefficient
UncertCoef

Uncertainty Coefficient
GetNewXL

Create a new Excel Instance
MedianCI

Confidence Interval for the Median
HexToCol

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

Hodges-Lehmann Estimator of Location
ImportFileDlg

Import File In Foreign Format
LsFct

List Functions of a Package
Permn

Number and Samples for Permutations or Combinations of a Set
PlotCandlestick

Plot Candlestick Chart
StrCountW

Count Words in a String
PolarGrid

Plot a Grid in Polar Coordinates
RoundM

Round to Multiple
ZTest

Z Test for Known Population Standard Deviation
PlotBubble

Draw a Bubble Plot
SortMixed

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

Odds Ratio Estimation and Confidence Intervals
StrRev

Reverse a String
PartitionBy

PartitionBy Evaluates a Function Groupwise
SetRowNames

Set the Row Names and Column Names in an Object
PlotArea

Create an Area Plot
StrIsNumeric

Does a String Contain Only Numeric Data
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
InDots

Is a Specific Argument in the Dots-Arguments?
HoeffD

Matrix of Hoeffding's D Statistics
Freq

Frequency Table
StrCap

Capitalize the First Letter of a String
StrVal

Extract All Numeric Values From a String
Lambda

Goodman Kruskal Lambda
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
split.formula

Formula Interface for Split
ShapiroFranciaTest

Shapiro-Francia test for normality
Sort

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

Moving Average
IsOdd

Checks If An Integer Is Even Or Odd
FindColor

Get Color on a Defined Color Range
wdConst

Word VBA constants
Untable

Recover Original Data From Contingency Table
StrAbbr

String Abbreviation
MeanAD

Mean Absolute Deviation From a Center Point
PlotPolar

Plot Values on a Circular Grid
WrdInsertBookmark

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

Levene's Test for Homogeneity of Variance
KendallW

Kendall's Coefficient of Concordance W
StuartTauC

Stuart $\tau_{c}$
Primes

Find all Primes Less Than n
SmoothSpline

Formula Interface For smooth.spline
PlotFdist

Frequency Distribution Plot
PasswordDlg

Password Dialog
SomersDelta

Somers' Delta
PlotTreemap

Create a Treemap
ParseSASDatalines

Parse a SAS Dataline Command
MosesTest

Moses Test of Extreme Reactions
NPV

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

Skewness and Kurtosis
XLGetRange

Import Data Directly From Excel
PlotECDF

Empirical Cumulative Distribution Function
%c%

Concatenates two strings without any separator.
PlotLinesA

Plot Lines
DunnettTest

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

Plot a Function
WrdTable

Produces a Table in Word
Strata

Stratified sampling
StrTrim

Remove Leading/Trailing Whitespace From A String
PlotMultiDens

Plot Multiple Density Curves
pRevGumbel

"Reverse" Gumbel Distribution Functions
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
TheilU

Theil's U index of inequality
power.chisq.test

Power Calculations for ChiSquared Tests
RunsTest

Runs Test for Randomness
VecRot

Vector Rotation
PoissonCI

Poisson Confidence Interval
Rev

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

Display descriptive plots
PlotViolin

Plot Violins Instead of Boxplots
PlotRCol

Information plots
KappaM

Kappa for m raters
Recycle

Recyle a List of Elements
PlotMosaic

Mosaic Plots
d.whisky

Classification of Scotch Single Malts
SignTest

Sign Test
RndPairs

Create Pairs of Correlated Random Numbers
PlotDot

Cleveland's Dot Plots
TextContrastColor

Choose Textcolor Depending on Background Color
UnitConv

Unit Conversion
IsValidWrd

Check Word Pointer
SelectVarDlg

Select Elements of a Set by Click
WoolfTest

Woolf Test
lines.lm

Add a Linear Regression Line
PlotFaces

Chernoff Faces
Vigenere

Vigenere Cypher
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
RobScale

Robust Scaling With Median and Mad
WrdR

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

Siegel-Tukey Test For Equality In Variability
d.periodic

Periodic Table of Elements
StrDist

Compute Distances Between Strings
d.pizza

Data pizza
TOne

Create Table One Describing Baseline Characteristics
XLView

Use Excel as Viewer for a Data.Frame
ZeroIfNA

Replace NAs by 0
XLDateToPOSIXct

Convert Excel Dates to POSIXct
StrAlign

Align Strings To a Specified Character
Recode

Recode a Factor
ToLong, ToWide

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

Post-Hoc Tests
d.countries

ISO 3166-1 Country Codes
Winsorize

Winsorize
StrLeft, StrRight

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

Yuen t-Test For Trimmed Means
%nin%

Find Matching (or Non-Matching) Elements
WrdCaption

Insert Caption to Word
DescWrd

Use Word as Reporting Tool for Describing Data
VarCI

Confidence Interval for the Variance
WrdSetFont

Set the Font in Word
median.factor

Median for Ordered Factors
Xplore

Interactive Graphical Data Explorer
identify.formula

Identify Points In a Plot Using a Formula.
as.matrix.xtabs

Convert xtabs To matrix
Gini

Gini Coefficient
WrdPlot

Insert Active Plot to Word
PlotCirc

Plot Circular Plot
SysInfo

System Information And DescTools Options
d.diamonds

Data diamonds
Desc.logical

Describe a dichotomous variable
lines.loess

Add a Loess or a Spline Smoother
StrPos

Find Position of First Occurrence Of a String
CutQ

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

Area Under the Curve
ColToHex

Convert a Color into Hex String
DivCoef

Rao's diversity coefficient also called quadratic entropy
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
PartCor

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

Compact Information About the Columns of a Data Frame
SpearmanRho

Spearman Rank Correlation
CochranArmitageTest

Cochran-Armitage test for trend
TextToTable

Converts String To a Table
HighLow

Return the Lowest and the Highest Values and Their Frequencies
CohenD

Cohen's Effect Size
DrawBezier

Draw a Bezier Curve
FctArgs

Retrieve a Functions' Arguments
GoodmanKruskalGamma

Goodman Kruskal's Gamma
GTest

G-Test for Count Data
DescTools Palettes

Some Custom Palettes
PlotQQ

QQ-Plot for Any Distribution
PlotWeb

Plot a Web of Connected Points
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
Str

Compactly Display the Structure of an Arbitrary R Object
Trim

Trim a Vector
Zodiac

Calculate the Zodiac of a Date
WrdInsTab

Insert a Table in a Word Document
DunnTest

Dunn's Test of Multiple Comparisons
Lc

Lorenz Curve
PairApply

Pairwise Calculations
RobRange

Robust Range