Learn R Programming

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

DescTools (version 0.99.9)

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 as well 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.9

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

January 20th, 2015

Functions in DescTools (0.99.9)

IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
BubbleLegend

Add a Legend to a Bubble Plot
DunnTest

Dunn's Test of Multiple Comparisons
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
BoxedText

Add Text in a Box to a Plot
BinToDec

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

Raw Simple And Extended Percentage Agreement
Canvas

Canvas for Geometric Plotting
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
Atkinson

Calculate the Atkinson Index
CronbachAlpha

Cronbach's Coefficient Alpha
BartelsRankTest

Bartels Rank Test
ConnLines

Add Connection Lines to a Barplot
AxisBreak

Place a Break Mark on an Axis
Benford

Benford's Distribution
ICC

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

Box Cox Transformation
ClipToVect

Reformat a Table in the Clipboard as Vector
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
Herfindahl

Concentration Measures
DrawRegPolygon

Draw Regular Polygon(s)
DrawBezier

Draw a Bezier Curve
Some numeric checks

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

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

Create a Date from Numeric Representation
Desc.numeric

Describe a numeric vector
Between

Between Operators Check, if a Value Lies Within a Given Range
DegToRad

Convert Degrees to Radians and vice versa
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
AUC

Area Under the Curve
Association measures

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

Confidence Intervals for Binomial Proportions
DunnettTest

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

Is a Distance Matrix Euclidean?
KappaM

Kappa for m raters
CochranQTest

Cochran's Q test
HexToRgb

Convert a Hexstring Color to a Matrix With Three Red/Green/Blue Rows
DescTools-internal

Internal DescTools objects
DivCoef

Rao's diversity coefficient also called quadratic entropy
Exec

Execute a Command Given As String
ColToRgb

Color to RGB Conversion
DrawBand

Draw Confidence Band
ColorLegend

Add a ColorLegend to a Plot
CCC

Concordance Correlation Coefficient
Hmean

Harmonic mean
InDots

Is a Specific Argument in the Dots-Arguments?
CollapseTable

Collapse Levels of a Table
CoefVar

Coefficient of Variation
Desc.logical

Describe a dichotomous variable
SetAlpha

Add an Alpha Channel To a Color
CohenD

Cohen's Effect Size
Contrasts

Pairwise Contrasts
DescWrd

Use Word as Reporting Tool for Describing Data
ColToHex

Convert a Color into Hex String
KendallW

Kendall's Coefficient of Concordance W
CatTable

Function to write a table
FisherZ

Fisher r to z and z to r and confidence intervals
AscToChar

Converts ASCII Codes to Characters and Vice Versa
Frac

Return the Fractional Part of a Numeric Value
CohenKappa

Cohen's Kappa and Weighted Kappa
GetNewPP

Create a new PowerPoint Instance
GetNewWrd

Create a new Word Instance
CramerVonMisesTest

Cramer-von Mises test for normality
AllDuplicated

Index Vector of All Values Involved in Ties
LeveneTest

Levene's Test for Homogeneity of Variance
GiniSimpson

Compute Gini-Simpson Coefficient
ColToGrey

Convert Colors to Grey/Grayscale
Format

Format Numbers and Dates
Freq

Frequency Table
MosesTest

Moses Test of Extreme Reactions
Desc.factor

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

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

Plot a Web of Connected Points
Assocs

Association Measures
PlotACF

Combined Plot of a Time Series and it's ACF and PACF
AddMonths

Add a Month to a Date
BinomDiffCI

Confidence Interval for a Difference of Binomials
ColToHsv

R Color to HSV Conversion
Closest

Find the Closest Value
Desc.integer

Describe an integer variable
MeanSE

Standard error of mean
HexToCol

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

Return the First Element Not Being NA
Desc.flags

Describe a Set of Dichotomous Variables
Desc.formula

Describe Variables by Groups
DrawAnnulus

Draw One or Several Annuli
PlotBubble

Draw a Bubble Plot
ChooseColorDlg

Display Color Dialog to Choose a Color
Desc

Describe Data
Label

Label Attribute of an Object
PlotDotCI

Plot a Dotchart with Confidence Intervals
Desc.table

Describe a n-dimensional Contingency Table
Dummy

Generate Dummy Codes for a Factor
Fibonacci

Fibonacci Numbers
Gmean

Geometric Mean and Standard Deviation
OddsRatio

Odds Ratio Estimation and Confidence Intervals
DenseRank

Dense Ranks
Factorize

Prime Factorization of Integers
ConDisPairs

Concordant and Discordant Pairs
Desc.data.frame

Describe a data.frame Or a List
GetCurrWrd

Get a Handle to a Running Word Instance
LsFct

List Functions of a Package
StrDist

Compute Distances Between Strings
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
Permn

Determine All Possible Permutations of a Set
LOF

Local Outlier Factor
HmsToSec

Convert h:m:s To/From Seconds
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
ParseFormula

Parse a Formula and Create a Model Frame
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
GoodmanKruskalGamma

Goodman Kruskal's Gamma
PoissonCI

Poisson Confidence Interval
PartCor

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

Draw Elliptic or Circular Arc(s)
StrIsNumeric

Does a String Contain Only Numeric Data
PlotHorizBar

Plot Horizontal Bars
Untable

Recover Original Data From Contingency Table
Large

Kth Smallest/Largest Values
ImportDlg

Get Path of a Data File to Be Opened
Midx

Find the Midpoints of a Numeric Vector
HotellingsT2Test

Hotelling's T2 Test
ErrBars

Add Error Bars to an Existing Plot
PlotFdist

Frequency Distribution Plot
ExpFreq

Expected frequencies
KendallTauB

Kendall tau-b
LOCF

Last Observation Carried Forward
RoundM

Round to Multiple
wdConst

Word VBA constants
reorder.factor

Reorder the Levels of a Factor
RgbToCol

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

Scatterplot Matrix
StrChop

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

Scheffe Test for Pairwise and Otherwise Comparisons
Outlier

Outlier
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
IsOdd

Checks If An Integer Is Even Or Odd
Winsorize

Winsorize
Lambda

Goodman Kruskal Lambda
MeanDiffCI

Confidence Interval For Difference of Means
UnitConv

Unit Conversion
GetPairs

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

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

List valid Keywords for R man pages
DrawAnnulusSector

Draw a Sector of an Annulus
WrdPlot

Insert Active Plot to Word
PlotCirc

Plot Circular Plot
DrawCircle

Draw a Circle
IsDichotomous

Test If a Variable Contains Only Two Unique Values
Logit

Generalized Logit and Inverse Logit function
FctArgs

Retrieve a Functions' Arguments
PairApply

Pairwise Calculations
WrdText

Insert Normal Text to Word
PlotFct

Plot a Function
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
MultinomCI

Confidence Intervals for Multinomial Proportions
HighLow

Return the Lowest and the Highest Values and Their Frequencies
Lc

Lorenz Curve
DescTools Palettes

Some Custom Palettes
ToWide

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

Mean Absolute Deviation From a Center Point
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
HoeffD

Matrix of Hoeffding's D Statistics
MoveAvg

Moving Average
PasswordDlg

Password Dialog
Rotate

Rotate a Geometric Structure
DescTools-package

Tools for Efficient Descriptive Statistics
Date Functions

Basic Date Functions
EtaSq

Effect size calculations for ANOVAs
PlotTernary

Ternary or Triangular Plots.
Gini

Gini Coefficient
DrawEllipse

Draw an Ellipse
FixToTab

Text to Table
Entropy

Shannon Entropy and Mutual Information
StrRev

Reverse a String
Vigenere

Vigenere Cypher
DivCoefMax

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

Get Color on a Defined Color Range
Mbind

Bind k nxm-matrices with the same dimension
GCD, LCM

Greatest Common Divisor and Least Common Multiple
LinScale

Perform a linear scaling of x
pRevGumbel

"Reverse" Gumbel Distribution Functions
PartitionBy

PartitionBy Evaluates a Function Groupwise
Ndec

Count Decimal Places of a Number
StrAbbr

String Abbreviation
LehmacherTest

Lehmacher's Test for Marginal Homogenity
Recycle

Recyle a List of Elements
PlotArea

Create an Area Plot
LogSt

Started Logarithmic Transformation and Its Inverse
WrdR

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

Plot Candlestick Chart
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
HuberM

Safe (generalized) Huber M-Estimator of Location
Mode

Mode
Str

Compactly Display the Structure of an Arbitrary R Object
IsValidWrd

Check Word Pointer
PlotPolar

Plot Values on a Circular Grid
SelectVarDlg

Select Elements of a Set by Click
RobRange

Robust Range
Primes

Find all Primes Less Than n
JarqueBeraTest

(Robust) Jarque Bera Test
PearsonTest

Pearson chi-square test for normality
StrTrunc

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

Recode a Factor
PlotPyramid

Draw a Back To Back Pyramid Plot
XLGetRange

Import Data Directly From Excel
PageTest

Exact Page Test for Ordered Alternatives
PlotMarDens

Scatterplot with Marginal Densities
SampleTwins

Sample Twins
d.countries

ISO 3166-1 Country Codes
LogLin

Log Linear Hybrid, Generalized Log
%nin%

Find Matching (or Non-Matching) Elements
RelRisk

Relative Risk
PlotDesc

Display descriptive plots
StrVal

Extract All Numeric Values From a String
PlotFaces

Chernoff Faces
d.periodic

Periodic Table of Elements
MixColor

Compute the convex combination of two colors
PlotVenn

Plot a Venn Diagram
PlotViolin

Plot Violins Instead of Boxplots
PolarGrid

Plot a Grid in Polar Coordinates
%c%

Concatenates two strings without any separator.
Measures of Shape

Skewness and Kurtosis
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
PlotCorr

Plot a Correlation Matrix
WrdInsTab

Insert a Table in a Word Document
PostHocTest

Post-Hoc Tests
identify.formula

Identify points in a plot using a formula.
StrTrim

Trim a string
RndPairs

Create Pairs of Correlated Random Numbers
XLView

Use Excel as Viewer for a Data.Frame
SpreadOut

Spread out a vector of numbers to a minimum interval
PlotRCol

Information plots
%like%

Like operator
Sort

Sort a Vector, a Matrix, a Table or a Data.frame
d.diamonds

Data diamonds
PlotQQ

QQ-Plot for Any Distribution
Mar

Set Plot Margins
StrRight

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

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

Plot Multiple Density Curves
lines.lm

Add a Linear Regression Line
StrPos

Find Position of First Occurrence Of a String
PlotTreemap

Create a Treemap
WrdSetFont

Set the Font in Word
ShapiroFranciaTest

Shapiro-Francia test for normality
Ray

Compact Information About the Columns of a Data Frame
SysInfo

System Information And DescTools Options
Rev

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

Confidence Interval for the Variance
PtInPoly

Point in Polygon
RobScale

Robust Scaling With Median and Mad
median.factor

Median for Ordered Factors
SiegelTukeyTest

Siegel-Tukey Test for equality in variability
RunsTest

Runs Test for Randomness
ZTest

Z Test for Known Population Standard Deviation
TheilU

Theil's U index of inequality
SignTest

Sign Test
ZeroIfNA

Replace NAs by 0
WrdCaption

Insert Caption to Word
split.formula

Formula Interface for Split
Zodiac

Calculate the Zodiac of a Date
StrCap

Capitalize the First Letter of a String
Trim

Trim a Vector
UncertCoef

Uncertainty Coefficient
StrPad

Pad a String With Justification
WoolfTest

Woolf Test
WrdInsertBookmark

Insert a Bookmark, Goto Bookmark and Update the Text of a Bookmark
day.name

Build-in Constants Extension
PlotBag

PlotBag, a bivariate boxplot
StuartTauC

Stuart Tau C
YuenTTest

Yuen t-Test For Trimmed Means
HodgesLehmann

Hodges-Lehmann Estimator of Location
GoodmanKruskalTauA

Goodman Kruskal's Tau a
GetAllSubsets

Get All Subsets out of a List of Elements
ParseSASDatalines

Parse a SAS Dataline Command
PlotDotCIp

Plot a Dotchart with Binomial Confidence Intervals
Rename

Change Names of a Named Object
SomersDelta

Somers' Delta
SpearmanRho

Spearman Rank Correlation
TextContrastColor

Choose Textcolor Depending on Background Color
Strata

Stratified sampling
lines.loess

Add a Loess or a Spline Smoother
d.pizza

Data pizza
IsPrime

IsPrime Property
CochranArmitageTest

Cochran-Armitage test for trend
Desc.Date

Describe a Date Vector
FindCorr

Determine highly correlated variables
IsDate

Check if an Object is of Type Date
GetNewXL

Create a new Excel Instance
MeanCI

Confidence Interval for the Mean
MHChisqTest

Mantel-Haenszel Chi-Square Test
MedianCI

Confidence Interval for the Median
PercTable

Percentage Table
Stamp

Date/Time/Directory Stamp the Current Plot
StrCountW

Count Words in a String
VecRot

Vector Rotation
WrdTable

Produces a Table in Word