Learn R Programming

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

DescTools (version 0.99.11)

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

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

May 15th, 2015

Functions in DescTools (0.99.11)

AUC

Area Under the Curve
Canvas

Canvas for Geometric Plotting
Agree

Raw Simple And Extended Percentage Agreement
BoxCox

Box Cox Transformation
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
DrawAnnulusSector

Draw a Sector of an Annulus
Assocs

Association Measures
CollapseTable

Collapse Levels of a Table
ClipToVect

Reformat a Table in the Clipboard as Vector
CohenD

Cohen's Effect Size
BartelsRankTest

Bartels Rank Test
DrawCircle

Draw a Circle
Desc.factor

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

Color to RGB Conversion
Clockwise

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

Confusion Matrix And Associated Statistics
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
BoxedText

Add Text in a Box to a Plot
Association measures

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

R Color to HSV Conversion
Between, Outside

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

Add an Alpha Channel To a Color
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
ColorLegend

Add a ColorLegend to a Plot
FindCorr

Determine highly correlated variables
Benford

Benford's Distribution
Desc

Describe Data
CochranQTest

Cochran's Q test
CCC

Concordance Correlation Coefficient
BinomCI

Confidence Intervals for Binomial Proportions
CronbachAlpha

Cronbach's Coefficient Alpha
IsPrime

IsPrime Property
GetAllSubsets

Get All Subsets out of a List of Elements
Desc.logical

Describe a dichotomous variable
CoefVar

Coefficient of Variation
Date Functions

Basic Date Functions
Label

Label Attribute of an Object
CramerVonMisesTest

Cramer-von Mises test for normality
DescTools-internal

Internal DescTools objects
Closest

Find the Closest Value
ConDisPairs

Concordant and Discordant Pairs
Gini

Gini Coefficient
HodgesLehmann

Hodges-Lehmann Estimator of Location
DrawBand

Draw Confidence Band
ColToGrey

Convert Colors to Grey/Grayscale
PlotViolin

Plot Violins Instead of Boxplots
Dummy

Generate Dummy Codes for a Factor
Desc.flags

Describe a Set of Dichotomous Variables
Coalesce

Return the First Element Not Being NA
DrawBezier

Draw a Bezier Curve
DunnettTest

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

Converts ASCII Codes to Characters and Vice Versa
GetNewPP

Create a new PowerPoint Instance
CohenKappa

Cohen's Kappa and Weighted Kappa
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
GTest

G-Test for Count Data
LogLin

Log Linear Hybrid, Generalized Log
CorPolychor

Polychoric Correlation
AddMonths

Add a Month to a Date
HexToCol

Identify closest match to a color given by a hexadecimal string
Desc.numeric

Describe a numeric vector
GiniSimpson

Compute Gini-Simpson Coefficient
BubbleLegend

Add a Legend to a Bubble Plot
Outlier

Outlier
Desc.table

Describe a n-dimensional Contingency Table
DenseRank

Dense Ranks
DurbinWatsonTest

Durbin-Watson Test
CochranArmitageTest

Cochran-Armitage test for trend
FindColor

Get Color on a Defined Color Range
HuberM

Safe (generalized) Huber M-Estimator of Location
LinScale

Perform a linear scaling of x
ConnLines

Add Connection Lines to a Barplot
GCD, LCM

Greatest Common Divisor and Least Common Multiple
CatTable

Function to write a table
PtInPoly

Point in Polygon
Contrasts

Pairwise Contrasts
HighLow

Return the Lowest and the Highest Values and Their Frequencies
Frac

Return the Fractional Part of a Numeric Value
DrawEllipse

Draw an Ellipse
DrawArc

Draw Elliptic or Circular Arc(s)
Mode

Mode
Hmean

Harmonic mean
IsOdd

Checks If An Integer Is Even Or Odd
JarqueBeraTest

(Robust) Jarque Bera Test
DivCoef

Rao's diversity coefficient also called quadratic entropy
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
Factorize

Prime Factorization of Integers
Desc.data.frame

Describe a data.frame Or a List
Fibonacci

Fibonacci Numbers
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
PlotVenn

Plot a Venn Diagram
InDots

Is a Specific Argument in the Dots-Arguments?
RobScale

Robust Scaling With Median and Mad
GetCurrWrd

Get a Handle to a Running Word Instance
AllDuplicated

Index Vector of All Values Involved in Ties
DescWrd

Use Word as Reporting Tool for Describing Data
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
DrawAnnulus

Draw One or Several Annuli
ColToHex

Convert a Color into Hex String
AxisBreak

Place a Break Mark on an Axis
ChooseColorDlg

Display Color Dialog to Choose a Color
EtaSq

Effect size calculations for ANOVAs
Date

Create a Date from Numeric Representation
Desc.integer

Describe an integer variable
DescTools-package

Tools for Efficient Descriptive Statistics
Atkinson

Calculate the Atkinson Index
PartitionBy

PartitionBy Evaluates a Function Groupwise
Freq

Frequency Table
BinomDiffCI

Confidence Interval for a Difference of Binomials
DunnTest

Dunn's Test of Multiple Comparisons
KappaM

Kappa for m raters
CutQ

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

Add Error Bars to an Existing Plot
Keywords

List valid Keywords for R man pages
SampleTwins

Sample Twins
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
Lambda

Goodman Kruskal Lambda
Mar

Set Plot Margins
LOCF

Last Observation Carried Forward
SpreadOut

Spread Out a Vector of Numbers To a Minimum Interval
MixColor

Compute the convex combination of two colors
TheilU

Theil's U index of inequality
PlotTernary

Ternary or Triangular Plots.
BinToDec

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

Interactive Graphical Data Explorer
HoeffD

Matrix of Hoeffding's D Statistics
GetNewXL

Create a new Excel Instance
HotellingsT2Test

Hotelling's T2 Test
MeanCI

Confidence Interval for the Mean
IsDichotomous

Test If a Variable Contains Only Two Unique Values
IsEuclid

Is a Distance Matrix Euclidean?
SelectVarDlg

Select Elements of a Set by Click
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
LeveneTest

Levene's Test for Homogeneity of Variance
Logit

Generalized Logit and Inverse Logit function
MedianCI

Confidence Interval for the Median
LehmacherTest

Lehmacher's Test for Marginal Homogenity
PlotBubble

Draw a Bubble Plot
MeanDiffCI

Confidence Interval For Difference of Means
Some numeric checks

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

Plot Multiple Density Curves
PlotDot

Cleveland's Dot Plots
StrPos

Find Position of First Occurrence Of a String
Untable

Recover Original Data From Contingency Table
UncertCoef

Uncertainty Coefficient
YuenTTest

Yuen t-Test For Trimmed Means
Str

Compactly Display the Structure of an Arbitrary R Object
FctArgs

Retrieve a Functions' Arguments
LOF

Local Outlier Factor
Gmean

Geometric Mean and Standard Deviation
GoodmanKruskalTauA

Goodman Kruskal's Tau a
NPV

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

Draw Regular Polygon(s)
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
PlotBag

PlotBag, a bivariate boxplot
PlotPyramid

Draw a Back To Back Pyramid Plot
PlotFaces

Chernoff Faces
StrAbbr

String Abbreviation
SysInfo

System Information And DescTools Options
PairApply

Pairwise Calculations
KendallTauB

Kendall tau-b
StrChop

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

Check Word Pointer
ImportDlg

Get Path of a Data File to Be Opened
PercTable

Percentage Table
Rev

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

Plot a Dotchart with Binomial Confidence Intervals
VecRot

Vector Rotation
PartCor

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

Unit Conversion
SomersDelta

Somers' Delta
WrdSetFont

Set the Font in Word
ZeroIfNA

Replace NAs by 0
Herfindahl

Concentration Measures
PlotFdist

Frequency Distribution Plot
Desc.formula

Describe Variables by Groups
KendallW

Kendall's Coefficient of Concordance W
Midx

Find the Midpoints of a Numeric Vector
Large

Kth Smallest/Largest Values
DivCoefMax

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

Recode a Factor
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
ParseSASDatalines

Parse a SAS Dataline Command
Sort

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

Mean Absolute Deviation From a Center Point
GetNewWrd

Create a new Word Instance
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PasswordDlg

Password Dialog
HmsToSec

Convert h:m:s To/From Seconds
PlotACF

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

Date/Time/Directory Stamp the Current Plot
StrVal

Extract All Numeric Values From a String
PlotMatrix

Scatterplot Matrix
Recycle

Recyle a List of Elements
PoissonCI

Poisson Confidence Interval
DescTools Palettes

Some Custom Palettes
lines.loess

Add a Loess or a Spline Smoother
Exec

Execute a Command Given As String
ParseFormula

Parse a Formula and Create a Model Frame
Vigenere

Vigenere Cypher
LogSt

Started Logarithmic Transformation and Its Inverse
day.name

Build-in Constants Extension
PlotCandlestick

Plot Candlestick Chart
Trim

Trim a Vector
Ray

Compact Information About the Columns of a Data Frame
Permn

Determine All Possible Permutations of a Set
PageTest

Exact Page Test for Ordered Alternatives
PlotTreemap

Create a Treemap
Ndec

Count Decimal Places of a Number
ExpFreq

Expected frequencies
Format

Format Numbers and Dates
FisherZ

Fisher r to z and z to r and confidence intervals
GoodmanKruskalGamma

Goodman Kruskal's Gamma
PolarGrid

Plot a Grid in Polar Coordinates
PlotHorizBar

Plot Horizontal Bars
PlotLinesA

Plot Lines
IsDate

Check if an Object is of Type Date
RelRisk

Relative Risk
PlotDotCI

Plot a Dotchart with Confidence Intervals
Primes

Find all Primes Less Than n
ToLong, ToWide

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

Calculate Tukey's Biweight Robust Mean
ICC

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

Plot a Web of Connected Points
median.factor

Median for Ordered Factors
PostHocTest

Post-Hoc Tests
reorder.factor

Reorder the Levels of a Factor
RgbToCol

Find the Named R-Color Which Is Nearest to a Given RGB-Color
StrLeft, StrRight

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

Choose Textcolor Depending on Background Color
GetPairs

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

Runs Test for Randomness
WrdPlot

Insert Active Plot to Word
LsFct

List Functions of a Package
pRevGumbel

"Reverse" Gumbel Distribution Functions
MHChisqTest

Mantel-Haenszel Chi-Square Test
XLGetRange

Import Data Directly From Excel
WoolfTest

Woolf Test
PlotCorr

Plot a Correlation Matrix
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
d.pizza

Data pizza
StrPad

Pad a String With Justification
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
PlotQQ

QQ-Plot for Any Distribution
ShapiroFranciaTest

Shapiro-Francia test for normality
XLView

Use Excel as Viewer for a Data.Frame
MosesTest

Moses Test of Extreme Reactions
VarCI

Confidence Interval for the Variance
StrCap

Capitalize the First Letter of a String
WrdCaption

Insert Caption to Word
RndPairs

Create Pairs of Correlated Random Numbers
power.chisq.test

Power Calculations for ChiSquared Tests
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
Rotate

Rotate a Geometric Structure
PlotArea

Create an Area Plot
SplitPath

Split Path In Drive, Path, Filename
d.periodic

Periodic Table of Elements
StuartTauC

Stuart $\tau_{c}$
RoundM

Round to Multiple
SignTest

Sign Test
%like%

Like operator
Measures of Shape

Skewness and Kurtosis
SaveAsDlg

Save R Objects By Choosing a File Interactively
StrTrim

Trim a string
SpearmanRho

Spearman Rank Correlation
ImportFileDlg

Import File In Foreign Format
lines.lm

Add a Linear Regression Line
WrdInsertBookmark

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

Plot Values on a Circular Grid
RobRange

Robust Range
Mbind

Bind k nxm-matrices with the same dimension
WrdInsTab

Insert a Table in a Word Document
MultinomCI

Confidence Intervals for Multinomial Proportions
d.diamonds

Data diamonds
StrCountW

Count Words in a String
WrdTable

Produces a Table in Word
identify.formula

Identify points in a plot using a formula.
PlotDesc

Display descriptive plots
wdConst

Word VBA constants
PlotFun

Plot a Function
Zodiac

Calculate the Zodiac of a Date
MoveAvg

Moving Average
PlotMarDens

Scatterplot with Marginal Densities
PlotRCol

Information plots
WrdR

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

Find Matching (or Non-Matching) Elements
StrRev

Reverse a String
PearsonTest

Pearson chi-square test for normality
Strata

Stratified sampling
PlotCirc

Plot Circular Plot
%c%

Concatenates two strings without any separator.
WrdText

Insert Normal Text to Word
as.matrix.xtabs

Xtabs to Matrix
SortMixed

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

Does a String Contain Only Numeric Data
split.formula

Formula Interface for Split
StrDist

Compute Distances Between Strings
StrTrunc

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

Winsorize
ZTest

Z Test for Known Population Standard Deviation
DegToRad

Convert Degrees to Radians and vice versa
Desc.Date

Describe a Date Vector
FixToTab

Text to Table
Entropy

Shannon Entropy and Mutual Information
HexToRgb

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

Lorenz Curve
NemenyiTest

Nemenyi Test
MeanSE

Standard error of mean
Rename

Change Names of a Named Object
d.countries

ISO 3166-1 Country Codes