Learn R Programming

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

DescTools (version 0.99.12)

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

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

August 21st, 2015

Functions in DescTools (0.99.12)

AxisBreak

Place a Break Mark on an Axis
BubbleLegend

Add a Legend to a Bubble Plot
Coalesce

Return the First Element Not Being NA
ClipToVect

Reformat a Table in the Clipboard as Vector
CohenKappa

Cohen's Kappa and Weighted Kappa
ColToHsv

R Color to HSV Conversion
ConnLines

Add Connection Lines to a Barplot
BoxedText

Add Text in a Box to a Plot
HighLow

Return the Lowest and the Highest Values and Their Frequencies
CutQ

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

Draw Confidence Band
HoeffD

Matrix of Hoeffding's D Statistics
DivCoefMax

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

Fractional Part and Maximal Digits of a Numeric Value
NemenyiTest

Nemenyi Test
Lc

Lorenz Curve
Abind

Combine multi-dimensional arrays
DivCoef

Rao's diversity coefficient also called quadratic entropy
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
Desc.logical

Describe a dichotomous variable
DrawBezier

Draw a Bezier Curve
Between, Outside

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

Execute a Command Given As String
DoCall

Fast Alternative To The Internal do.call
BoxCox

Box Cox Transformation
InDots

Is a Specific Argument in the Dots-Arguments?
DrawCircle

Draw a Circle
GTest

G-Test for Count Data
Assocs

Association Measures
CollapseTable

Collapse Levels of a Table
Canvas

Canvas for Geometric Plotting
AUC

Area Under the Curve
IsDichotomous

Test If a Variable Contains Only Two Unique Values
CorPolychor

Polychoric Correlation
Clockwise

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

Draw Elliptic or Circular Arc(s)
BinTree

Binary Tree
BinomDiffCI

Confidence Interval for a Difference of Binomials
GiniSimpson

Compute Gini-Simpson Coefficient
ColToRgb

Color to RGB Conversion
Contrasts

Pairwise Contrasts
Desc.integer

Describe an integer variable
Desc.Date

Describe a Date Vector
Entropy

Shannon Entropy and Mutual Information
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
CatTable

Function to write a table
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
GoodmanKruskalTauA

Goodman Kruskal's Tau a
Date Functions

Basic Date Functions
Agree

Raw Simple And Extended Percentage Agreement
AddMonths

Add a Month to a Date
GetCurrWrd

Get a Handle to a Running Word Instance
MosesTest

Moses Test of Extreme Reactions
Atkinson

Calculate the Atkinson Index
FindColor

Get Color on a Defined Color Range
ColToGrey

Convert Colors to Grey/Grayscale
PlotCorr

Plot a Correlation Matrix
ColToHex

Convert a Color into Hex String
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
CoefVar

Coefficient of Variation
Format

Format Numbers and Dates
CramerVonMisesTest

Cramer-von Mises test for normality
MeanCI

Confidence Interval for the Mean
GetNewWrd

Create a new Word Instance
Recode

Recode a Factor
Rev

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

Draw Regular Polygon(s)
Ndec

Count Decimal Places of a Number
PartCor

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

Draw a Sector of an Annulus
SaveAsDlg

Save R Objects By Choosing a File Interactively
WrdCaption

Insert Caption to Word
Some numeric checks

Check a Vector For Being Numeric, Zero Or a Whole Number
Desc.formula

Describe Variables by Groups
TextToTable

Converts String To a Table
IsEuclid

Is a Distance Matrix Euclidean?
RobScale

Robust Scaling With Median and Mad
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
ColorLegend

Add a ColorLegend to a Plot
Gmean

Geometric Mean and Standard Deviation
IsOdd

Checks If An Integer Is Even Or Odd
AscToChar

Convert ASCII Codes to Characters and Vice Versa
PlotACF

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

Capitalize the First Letter of a String
PlotBubble

Draw a Bubble Plot
GCD, LCM

Greatest Common Divisor and Least Common Multiple
Rotate

Rotate a Geometric Structure
FisherZ

Fisher r to z and z to r and confidence intervals
Stamp

Date/Time/Directory Stamp the Current Plot
CCC

Concordance Correlation Coefficient
DescTools Palettes

Some Custom Palettes
HexToCol

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

Scatterplot with Marginal Densities
ChooseColorDlg

Display Color Dialog to Choose a Color
Dummy

Generate Dummy Codes for a Factor
HmsToSec

Convert h:m:s To/From Seconds
PlotRCol

Information plots
SampleTwins

Sample Twins
Ray

Compact Information About the Columns of a Data Frame
StrLeft, StrRight

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

Add Error Bars to an Existing Plot
HodgesLehmann

Hodges-Lehmann Estimator of Location
PairApply

Pairwise Calculations
Closest

Find the Closest Value
PlotFun

Plot a Function
KendallW

Kendall's Coefficient of Concordance W
CochranArmitageTest

Cochran-Armitage test for trend
Strata

Stratified sampling
Desc

Describe Data
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
IsPrime

IsPrime Property
Keywords

List valid Keywords for R man pages
LogSt

Started Logarithmic Transformation and Its Inverse
LOF

Local Outlier Factor
LOCF

Last Observation Carried Forward
Hmean

Harmonic mean
PlotArea

Create an Area Plot
DrawEllipse

Draw an Ellipse
PlotMosaic

Mosaic Plots
CronbachAlpha

Cronbach's Coefficient Alpha
Lambda

Goodman Kruskal Lambda
PolarGrid

Plot a Grid in Polar Coordinates
FctArgs

Retrieve a Functions' Arguments
WrdTable

Produces a Table in Word
Primes

Find all Primes Less Than n
Logit

Generalized Logit and Inverse Logit function
SetAlpha

Add an Alpha Channel To a Color
Desc.flags

Describe a Set of Dichotomous Variables
Association measures

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

Poisson Confidence Interval
PlotCandlestick

Plot Candlestick Chart
DegToRad

Convert Degrees to Radians and vice versa
IsValidWrd

Check Word Pointer
RndPairs

Create Pairs of Correlated Random Numbers
Desc.numeric

Describe a numeric vector
Midx

Find the Midpoints of a Numeric Vector
ExpFreq

Expected frequencies
DescWrd

Use Word as Reporting Tool for Describing Data
ShapiroFranciaTest

Shapiro-Francia test for normality
HotellingsT2Test

Hotelling's T2 Test
HuberM

Safe (generalized) Huber M-Estimator of Location
d.pizza

Data pizza
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
XLView

Use Excel as Viewer for a Data.Frame
PlotViolin

Plot Violins Instead of Boxplots
PlotECDF

Empirical Cumulative Distribution Function
PtInPoly

Point in Polygon
ToLong, ToWide

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

Durbin-Watson Test
FixToTab

Text to Table
YuenTTest

Yuen t-Test For Trimmed Means
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
StrIsNumeric

Does a String Contain Only Numeric Data
StrAbbr

String Abbreviation
GetNewPP

Create a new PowerPoint Instance
Desc.table

Describe a n-dimensional Contingency Table
median.factor

Median for Ordered Factors
Desc.data.frame

Describe a data.frame Or a List
KendallTauB

Kendall tau-b
power.chisq.test

Power Calculations for ChiSquared Tests
StrDist

Compute Distances Between Strings
RgbToCol

Find the Named R-Color Which Is Nearest to a Given RGB-Color
identify.formula

Identify points in a plot using a formula.
JarqueBeraTest

(Robust) Jarque Bera Test
StrRev

Reverse a String
RobRange

Robust Range
Measures of Shape

Skewness and Kurtosis
LehmacherTest

Lehmacher's Test for Marginal Homogenity
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
StrChop

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

Get All Pairs out of one or two Sets of Elements
day.name

Build-in Constants Extension
XLDateToPOSIXct

Convert Excel Dates to POSIXct
GetNewXL

Create a new Excel Instance
RunsTest

Runs Test for Randomness
as.matrix.xtabs

Convert xtabs To matrix
PlotFaces

Chernoff Faces
Str

Compactly Display the Structure of an Arbitrary R Object
Recycle

Recyle a List of Elements
ImportFileDlg

Import File In Foreign Format
PlotCirc

Plot Circular Plot
SetRowNames

Set the Row Names and Column Names in an Object
LinScale

Perform a linear scaling of x
Date

Create a Date from Numeric Representation
StrCountW

Count Words in a String
%nin%

Find Matching (or Non-Matching) Elements
StrPad

Pad a String With Justification
wdConst

Word VBA constants
DunnTest

Dunn's Test of Multiple Comparisons
Untable

Recover Original Data From Contingency Table
PlotHorizBar

Plot Horizontal Bars
ZeroIfNA

Replace NAs by 0
Factorize

Prime Factorization of Integers
Zodiac

Calculate the Zodiac of a Date
SomersDelta

Somers' Delta
GoodmanKruskalGamma

Goodman Kruskal's Gamma
WrdText

Insert Normal Text to Word
LsFct

List Functions of a Package
StrPos

Find Position of First Occurrence Of a String
pRevGumbel

"Reverse" Gumbel Distribution Functions
NPV

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

Kth Smallest/Largest Values
PasswordDlg

Password Dialog
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
Sort

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

Post-Hoc Tests
XLGetRange

Import Data Directly From Excel
TOne

Create Table One Describing Baseline Characteristics
PlotTernary

Ternary or Triangular Plots.
SignTest

Sign Test
Herfindahl

Concentration Measures
%like%

Like operator
d.diamonds

Data diamonds
reorder.factor

Reorder the Levels of a Factor
LeveneTest

Levene's Test for Homogeneity of Variance
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
BinomCI

Confidence Intervals for Binomial Proportions
WrdR

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

Spearman Rank Correlation
PlotDesc

Display descriptive plots
HexToRgb

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

Choose Textcolor Depending on Background Color
BartelsRankTest

Bartels Rank Test
d.periodic

Periodic Table of Elements
Fibonacci

Fibonacci Numbers
split.formula

Formula Interface for Split
Xplore

Interactive Graphical Data Explorer
EtaSq

Effect size calculations for ANOVAs
PDFManual

Get PDF Manual Of a Package From CRAN
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PageTest

Exact Page Test for Ordered Alternatives
ImportDlg

Get Path of a Data File to Be Opened
ParseSASDatalines

Parse a SAS Dataline Command
Outlier

Outlier
Winsorize

Winsorize
WrdSetFont

Set the Font in Word
RelRisk

Relative Risk
PlotBag

PlotBag, a bivariate boxplot
Gini

Gini Coefficient
Label

Label Attribute of an Object
BinToDec

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

Stuart $\tau_{c}$
lines.lm

Add a Linear Regression Line
ParseFormula

Parse a Formula and Create a Model Frame
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
PercTable

Percentage Table
Vigenere

Vigenere Cypher
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
Mar

Set Plot Margins
ZTest

Z Test for Known Population Standard Deviation
CochranQTest

Cochran's Q test
ConDisPairs

Concordant and Discordant Pairs
StrAlign

Align Strings To a Specified Character
%c%

Concatenates two strings without any separator.
axTicks.POSIXct

Compute Axis Tickmark Locations (For POSIXct Axis)
Desc.factor

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

Confidence Interval for the Median
WrdInsTab

Insert a Table in a Word Document
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
PlotFdist

Frequency Distribution Plot
PlotPolar

Plot Values on a Circular Grid
DescTools-package

Tools for Descriptive Statistics and Exploratory Data Analysis
MoveAvg

Moving Average
PlotPyramid

Draw a Back To Back Pyramid Plot
StrVal

Extract All Numeric Values From a String
MeanAD

Mean Absolute Deviation From a Center Point
Permn

Number and Samples for Permutations or Combinations of a Set
RoundM

Round to Multiple
PlotLinesA

Plot Lines
PearsonTest

Pearson chi-square test for normality
MeanDiffCI

Confidence Interval For Difference of Means
SortMixed

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

Plot Multiple Density Curves
DrawAnnulus

Draw One or Several Annuli
MultinomCI

Confidence Intervals for Multinomial Proportions
PlotVenn

Plot a Venn Diagram
Eps

Greenhouse-Geisser And Huynh-Feldt Epsilons
MHChisqTest

Mantel-Haenszel Chi-Square Test
StrTrunc

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

System Information And DescTools Options
StrTrim

Remove Leading/Trailing Whitespace From A String
PartitionBy

PartitionBy Evaluates a Function Groupwise
UnitConv

Unit Conversion
WrdInsertBookmark

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

Confidence Interval for the Variance
WrdPlot

Insert Active Plot to Word
PlotWeb

Plot a Web of Connected Points
d.countries

ISO 3166-1 Country Codes
SelectVarDlg

Select Elements of a Set by Click
UncertCoef

Uncertainty Coefficient
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
Trim

Trim a Vector
lines.loess

Add a Loess or a Spline Smoother
Benford

Benford's Distribution
CohenD

Cohen's Effect Size
DunnettTest

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

Kappa for m raters
IsDate

Check if an Object is of Type Date
Mode

Mode
MeanSE

Standard error of mean
PlotDot

Cleveland's Dot Plots
PlotQQ

QQ-Plot for Any Distribution
Rename

Change Names of a Named Object
DenseRank

Dense Ranks
AllDuplicated

Index Vector of All Values Involved in Ties
FindCorr

Determine highly correlated variables
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
SplitPath

Split Path In Drive, Path, Filename
Conf

Confusion Matrix And Associated Statistics
TheilU

Theil's U index of inequality
Freq

Frequency Table
VecRot

Vector Rotation
ICC

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

Log Linear Hybrid, Generalized Log
MixColor

Compute the convex combination of two colors
PlotMatrix

Scatterplot Matrix
PlotTreemap

Create a Treemap
WoolfTest

Woolf Test