Learn R Programming

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

DescTools (version 0.99.10)

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

License

GPL (>= 2)

Maintainer

Andri Signorell

Last Published

March 21st, 2015

Functions in DescTools (0.99.10)

AddMonths

Add a Month to a Date
Between

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

Display Color Dialog to Choose a Color
AllDuplicated

Index Vector of All Values Involved in Ties
BinomCI

Confidence Intervals for Binomial Proportions
Assocs

Association Measures
CutQ

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

Cohen's Effect Size
Date Functions

Basic Date Functions
Desc.integer

Describe an integer variable
CCC

Concordance Correlation Coefficient
KendallW

Kendall's Coefficient of Concordance W
Coalesce

Return the First Element Not Being NA
IsEuclid

Is a Distance Matrix Euclidean?
ConnLines

Add Connection Lines to a Barplot
AscToChar

Converts ASCII Codes to Characters and Vice Versa
BoxCox

Box Cox Transformation
CochranArmitageTest

Cochran-Armitage test for trend
BoxedText

Add Text in a Box to a Plot
BreslowDayTest

Breslow-Day Test for Homogeneity of the Odds Ratios
Factorize

Prime Factorization of Integers
HighLow

Return the Lowest and the Highest Values and Their Frequencies
DurbinWatsonTest

Durbin-Watson Test
ColToHsv

R Color to HSV Conversion
LinScale

Perform a linear scaling of x
Desc.formula

Describe Variables by Groups
CoefVar

Coefficient of Variation
BubbleLegend

Add a Legend to a Bubble Plot
Atkinson

Calculate the Atkinson Index
ColToGrey

Convert Colors to Grey/Grayscale
AndersonDarlingTest

Anderson-Darling Test of Goodness-of-Fit
Exec

Execute a Command Given As String
DrawAnnulus

Draw One or Several Annuli
GCD, LCM

Greatest Common Divisor and Least Common Multiple
BinToDec

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

Create a new Excel Instance
GetNewPP

Create a new PowerPoint Instance
Agree

Raw Simple And Extended Percentage Agreement
CatTable

Function to write a table
BinomDiffCI

Confidence Interval for a Difference of Binomials
IdentifyA

Identify Points in Plot Lying within a Rectangle or Polygon
Mbind

Bind k nxm-matrices with the same dimension
PlotCirc

Plot Circular Plot
AxisBreak

Place a Break Mark on an Axis
DescTools-internal

Internal DescTools objects
Entropy

Shannon Entropy and Mutual Information
IsPrime

IsPrime Property
IsValidWrd

Check Word Pointer
DegToRad

Convert Degrees to Radians and vice versa
GoodmanKruskalGamma

Goodman Kruskal's Gamma
HexToRgb

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

Dunn's Test of Multiple Comparisons
ParseFormula

Parse a Formula and Create a Model Frame
Contrasts

Pairwise Contrasts
DrawBezier

Draw a Bezier Curve
Lambda

Goodman Kruskal Lambda
CochranQTest

Cochran's Q test
Desc.numeric

Describe a numeric vector
Fibonacci

Fibonacci Numbers
Gini

Gini Coefficient
Freq

Frequency Table
PlotPolar

Plot Values on a Circular Grid
Benford

Benford's Distribution
AUC

Area Under the Curve
CartToPol

Transform Cartesian to Polar/Spherical Coordinates and vice versa
Explore

Interactive Explorer
DivCoef

Rao's diversity coefficient also called quadratic entropy
Desc.logical

Describe a dichotomous variable
BoxCoxLambda

Automatic Selection of Box Cox Transformation Parameter
GetCurrWrd

Get a Handle to a Running Word Instance
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
ClipToVect

Reformat a Table in the Clipboard as Vector
DrawRegPolygon

Draw Regular Polygon(s)
Desc.Date

Describe a Date Vector
DunnettTest

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

Mean Absolute Deviation From a Center Point
CramerVonMisesTest

Cramer-von Mises test for normality
CollapseTable

Collapse Levels of a Table
HoeffD

Matrix of Hoeffding's D Statistics
ImportDlg

Get Path of a Data File to Be Opened
DrawArc

Draw Elliptic or Circular Arc(s)
DrawCircle

Draw a Circle
ColorLegend

Add a ColorLegend to a Plot
FindCorr

Determine highly correlated variables
Lc

Lorenz Curve
ColToRgb

Color to RGB Conversion
Label

Label Attribute of an Object
Format

Format Numbers and Dates
GiniSimpson

Compute Gini-Simpson Coefficient
ExpFreq

Expected frequencies
Date

Create a Date from Numeric Representation
Dummy

Generate Dummy Codes for a Factor
SetAlpha

Add an Alpha Channel To a Color
ConDisPairs

Concordant and Discordant Pairs
Clockwise

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

Is a Specific Argument in the Dots-Arguments?
DrawBand

Draw Confidence Band
BartelsRankTest

Bartels Rank Test
Desc.data.frame

Describe a data.frame Or a List
Frac

Return the Fractional Part of a Numeric Value
FixToTab

Text to Table
DenseRank

Dense Ranks
DescTools-package

Tools for Efficient Descriptive Statistics
KendallTauB

Kendall tau-b
Canvas

Canvas for Geometric Plotting
GetNewWrd

Create a new Word Instance
ErrBars

Add Error Bars to an Existing Plot
LOCF

Last Observation Carried Forward
LeveneTest

Levene's Test for Homogeneity of Variance
Mar

Set Plot Margins
Large

Kth Smallest/Largest Values
MoveAvg

Moving Average
HodgesLehmann

Hodges-Lehmann Estimator of Location
Closest

Find the Closest Value
OddsRatio

Odds Ratio Estimation and Confidence Intervals
PlotRCol

Information plots
RelRisk

Relative Risk
MixColor

Compute the convex combination of two colors
PolarGrid

Plot a Grid in Polar Coordinates
FctArgs

Retrieve a Functions' Arguments
DescWrd

Use Word as Reporting Tool for Describing Data
CohenKappa

Cohen's Kappa and Weighted Kappa
PageTest

Exact Page Test for Ordered Alternatives
PlotPyramid

Draw a Back To Back Pyramid Plot
Herfindahl

Concentration Measures
PairApply

Pairwise Calculations
Zodiac

Calculate the Zodiac of a Date
Desc.table

Describe a n-dimensional Contingency Table
XLGetRange

Import Data Directly From Excel
TukeyBiweight

Calculate Tukey's Biweight Robust Mean
GetAllSubsets

Get All Subsets out of a List of Elements
KrippAlpha

Krippendorff's Alpha Reliability Coefficient
Ray

Compact Information About the Columns of a Data Frame
JonckheereTerpstraTest

Exact Version of Jonckheere-Terpstra Test
PlotMarDens

Scatterplot with Marginal Densities
Untable

Recover Original Data From Contingency Table
Some numeric checks

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

Unit Conversion
PpPlot

Add Slides, Insert Texts and Plots to PowerPoint
IsDate

Check if an Object is of Type Date
EtaSq

Effect size calculations for ANOVAs
JarqueBeraTest

(Robust) Jarque Bera Test
IsOdd

Checks If An Integer Is Even Or Odd
GetPairs

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

Plot Multiple Density Curves
ICC

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

Lehmacher's Test for Marginal Homogenity
Ndec

Count Decimal Places of a Number
ShapiroFranciaTest

Shapiro-Francia test for normality
PlotDesc

Display descriptive plots
IsDichotomous

Test If a Variable Contains Only Two Unique Values
MeanSE

Standard error of mean
MosesTest

Moses Test of Extreme Reactions
RoundM

Round to Multiple
RndPairs

Create Pairs of Correlated Random Numbers
MHChisqTest

Mantel-Haenszel Chi-Square Test
Midx

Find the Midpoints of a Numeric Vector
MedianCI

Confidence Interval for the Median
GoodmanKruskalTauA

Goodman Kruskal's Tau a
Hmean

Harmonic mean
HuberM

Safe (generalized) Huber M-Estimator of Location
Rotate

Rotate a Geometric Structure
PasswordDlg

Password Dialog
StrCap

Capitalize the First Letter of a String
PlotMatrix

Scatterplot Matrix
PearsonTest

Pearson chi-square test for normality
DrawEllipse

Draw an Ellipse
HexToCol

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

Plot a Venn Diagram
VarCI

Confidence Interval for the Variance
LsFct

List Functions of a Package
Gmean

Geometric Mean and Standard Deviation
Stamp

Date/Time/Directory Stamp the Current Plot
Mode

Mode
MeanDiffCI

Confidence Interval For Difference of Means
KappaM

Kappa for m raters
PartCor

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

Robust Scaling With Median and Mad
LillieTest

Lilliefors (Kolmogorov-Smirnov) test for normality
StrVal

Extract All Numeric Values From a String
LOF

Local Outlier Factor
PartitionBy

PartitionBy Evaluates a Function Groupwise
MultinomCI

Confidence Intervals for Multinomial Proportions
LogSt

Started Logarithmic Transformation and Its Inverse
PlotFdist

Frequency Distribution Plot
DescTools Palettes

Some Custom Palettes
Measures of Shape

Skewness and Kurtosis
PlotBag

PlotBag, a bivariate boxplot
PlotDotCI

Plot a Dotchart with Confidence Intervals
PoissonCI

Poisson Confidence Interval
Logit

Generalized Logit and Inverse Logit function
PlotTernary

Ternary or Triangular Plots.
StuartTauC

Stuart Tau C
PlotHorizBar

Plot Horizontal Bars
Permn

Determine All Possible Permutations of a Set
PlotMonth

Plot Monthly or Seasonal Effects Of a Univariate Time Series
Recode

Recode a Factor
Rename

Change Names of a Named Object
SignTest

Sign Test
SampleTwins

Sample Twins
LogLin

Log Linear Hybrid, Generalized Log
PlotViolin

Plot Violins Instead of Boxplots
StrAbbr

String Abbreviation
Trim

Trim a Vector
WrdText

Insert Normal Text to Word
ZTest

Z Test for Known Population Standard Deviation
d.periodic

Periodic Table of Elements
TextContrastColor

Choose Textcolor Depending on Background Color
PlotBubble

Draw a Bubble Plot
MeanCI

Confidence Interval for the Mean
PlotTreemap

Create a Treemap
Outlier

Outlier
Keywords

List valid Keywords for R man pages
NPV

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

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

Winsorize
Strata

Stratified sampling
RunsTest

Runs Test for Randomness
PlotFaces

Chernoff Faces
StrRight

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

Plot Candlestick Chart
YuenTTest

Yuen t-Test For Trimmed Means
StrCountW

Count Words in a String
WrdPlot

Insert Active Plot to Word
PtInPoly

Point in Polygon
UncertCoef

Uncertainty Coefficient
StrIsNumeric

Does a String Contain Only Numeric Data
PlotArea

Create an Area Plot
TheilU

Theil's U index of inequality
StrRev

Reverse a String
XLView

Use Excel as Viewer for a Data.Frame
WrdR

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

Find Position of First Occurrence Of a String
Vigenere

Vigenere Cypher
PlotQQ

QQ-Plot for Any Distribution
PlotWeb

Plot a Web of Connected Points
day.name

Build-in Constants Extension
ToWide

Reshape a Vector From Long to Wide Shape Or Vice Versa
reorder.factor

Reorder the Levels of a Factor
SaveAs

Save R Objects By Choosing a File Interactively
Primes

Find all Primes Less Than n
PercTable

Percentage Table
Str

Compactly Display the Structure of an Arbitrary R Object
PlotFct

Plot a Function
WrdInsertBookmark

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

Woolf Test
ScheffeTest

Scheffe Test for Pairwise and Otherwise Comparisons
ParseSASDatalines

Parse a SAS Dataline Command
StrDist

Compute Distances Between Strings
PlotDotCIp

Plot a Dotchart with Binomial Confidence Intervals
WrdCaption

Insert Caption to Word
StrTrunc

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

Find the Named R-Color Which Is Nearest to a Given RGB-Color
d.countries

ISO 3166-1 Country Codes
Recycle

Recyle a List of Elements
StrChop

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

Trim a string
median.factor

Median for Ordered Factors
SelectVarDlg

Select Elements of a Set by Click
identify.formula

Identify points in a plot using a formula.
SpearmanRho

Spearman Rank Correlation
WrdInsTab

Insert a Table in a Word Document
d.diamonds

Data diamonds
RobRange

Robust Range
WrdSetFont

Set the Font in Word
SiegelTukeyTest

Siegel-Tukey Test For Equality In Variability
PostHocTest

Post-Hoc Tests
StrPad

Pad a String With Justification
StuartMaxwellTest

Stuart-Maxwell Marginal Homogeneity Test
lines.lm

Add a Linear Regression Line
VecRot

Vector Rotation
WrdTable

Produces a Table in Word
d.pizza

Data pizza
%overlaps%

Determines If And How Extensively Two Date Ranges Overlap
%c%

Concatenates two strings without any separator.
%nin%

Find Matching (or Non-Matching) Elements
split.formula

Formula Interface for Split
fastPOSIXct

Fast version of as.POSIXct.character for GMT fixed format.
%like%

Like operator
wdConst

Word VBA constants
Desc.flags

Describe a Set of Dichotomous Variables
Desc.factor

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

Cronbach's Coefficient Alpha
ColToHex

Convert a Color into Hex String
DrawAnnulusSector

Draw a Sector of an Annulus
Desc

Describe Data
FisherZ

Fisher r to z and z to r and confidence intervals
DivCoefMax

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

Convert h:m:s To/From Seconds
Sort

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

Hotelling's T2 Test
PlotCorr

Plot a Correlation Matrix
SysInfo

System Information And DescTools Options
pRevGumbel

"Reverse" Gumbel Distribution Functions
Rev

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

Somers' Delta
SortMixed

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

Spread Out a Vector of Numbers To a Minimum Interval
ZeroIfNA

Replace NAs by 0
lines.loess

Add a Loess or a Spline Smoother