package ‘desctools’ - r ‘desctools ... (which themselves might depend on other packages which...

569
Package ‘DescTools’ March 19, 2018 Type Package Title Tools for Descriptive Statistics Version 0.99.24 Date 2018-03-18 Author Andri Signorell. Includes R source code and/or documentation previously published by (in al- phabetical order): Ken Aho, Andreas Alfons, Nanina An- deregg, Tomas Aragon, Antti Arppe, Adrian Baddeley, Kamil Barton, Ben Bolker, Fred- erico Caeiro, Stephane Champely, Daniel Chessel, Leanne Chhay, Clint Cum- mins, Michael Dewey, Harold C. Doran, Stephane Dray, Charles Dupont, Dirk Eddelbuet- tel, Jeff Enos, Claus Ekstrom, Martin Elff, Kamil Erguler, Richard W. Farebrother, John Fox, Ro- main Francois, Michael Friendly, Tal Galili, Matthias Gamer, Joseph L. Gastwirth, Yu- lia R. Gel, Juergen Gross, Gabor Grothendieck, Frank E. Har- rell Jr, Richard Heiberger, Michael Hoehle, Christian W. Hoff- mann, Torsten Hothorn, Markus Huerzeler, Wallace W. Hui, Pete Hurd, Rob J. Hynd- man, Pablo J. Villacorta Iglesias, Christopher Jackson, Matthias Kohl, Mikko Kor- pela, Max Kuhn, Detlew Labes, Friederich Leisch, Jim Lemon, Dong Li, Martin Maech- ler, Arni Magnusson, Daniel Mal- ter, George Marsaglia, John Marsaglia, Alina Matei, David Meyer, Weiwen Miao, Gio- vanni Millo, Yongyi Min, David Mitchell, Markus Naepflin, Daniel Navarro, Henric Nils- son, Klaus Nordhausen, Derek Ogle, Hong Ooi, Nick Parsons, San- drine Pavoine, Tony Plate, Roland Rapold, William Revelle, Tyler Rinker, Brian D. Ripley, Caro- line Rodriguez, Nathan Russell, Nick Sabbe, Venkatraman E. Seshan, Greg Snow, Michael Smith- son, Werner A. Stahel, Alec Stephenson, Mark Stevenson, Matthias Templ, Terry Th- erneau, Yves Tille, Adrian Trapletti, Joshua Ulrich, Kevin Ushey, Jeremy VanDerWal, Bill Ven- ables, John Verzani, Gregory R. Warnes, Stefan Wellek, Hadley Wickham, Rand R. Wilcox, Pe- ter Wolf, Daniel Wollschlaeger, Thomas Yee, Achim Zeileis Maintainer Andri Signorell <[email protected]> Description A collection of miscellaneous basic statistic functions and convenience wrappers for effi- ciently describing data. The author's intention was to create a toolbox, which facilitates the (no- toriously time consuming) first descriptive tasks in data analysis, consisting of calculating de- scriptive statistics, drawing graphical summaries and reporting the results. The package con- tains furthermore functions to produce documents using MS Word (or PowerPoint) and func- tions to import data from Excel. Many of the included functions can be found scat- tered in other packages and other sources written partly by Titans of R. The reason for collect- 1

Upload: dinhnhan

Post on 17-May-2018

316 views

Category:

Documents


15 download

TRANSCRIPT

  • Package DescToolsMarch 19, 2018

    Type Package

    Title Tools for Descriptive Statistics

    Version 0.99.24

    Date 2018-03-18

    Author Andri Signorell. Includes R source code and/or documentation previously published by (in al-phabetical order): Ken Aho, Andreas Alfons, Nanina An-deregg, Tomas Aragon, Antti Arppe, Adrian Baddeley, Kamil Barton, Ben Bolker, Fred-erico Caeiro, Stephane Champely, Daniel Chessel, Leanne Chhay, Clint Cum-mins, Michael Dewey, Harold C. Doran, Stephane Dray, Charles Dupont, Dirk Eddelbuet-tel, Jeff Enos, Claus Ekstrom, Martin Elff, Kamil Erguler, Richard W. Farebrother, John Fox, Ro-main Francois, Michael Friendly, Tal Galili, Matthias Gamer, Joseph L. Gastwirth, Yu-lia R. Gel, Juergen Gross, Gabor Grothendieck, Frank E. Har-rell Jr, Richard Heiberger, Michael Hoehle, Christian W. Hoff-mann, Torsten Hothorn, Markus Huerzeler, Wallace W. Hui, Pete Hurd, Rob J. Hynd-man, Pablo J. Villacorta Iglesias, Christopher Jackson, Matthias Kohl, Mikko Kor-pela, Max Kuhn, Detlew Labes, Friederich Leisch, Jim Lemon, Dong Li, Martin Maech-ler, Arni Magnusson, Daniel Mal-ter, George Marsaglia, John Marsaglia, Alina Matei, David Meyer, Weiwen Miao, Gio-vanni Millo, Yongyi Min, David Mitchell, Markus Naepflin, Daniel Navarro, Henric Nils-son, Klaus Nordhausen, Derek Ogle, Hong Ooi, Nick Parsons, San-drine Pavoine, Tony Plate, Roland Rapold, William Revelle, Tyler Rinker, Brian D. Ripley, Caro-line Rodriguez, Nathan Russell, Nick Sabbe, Venkatraman E. Seshan, Greg Snow, Michael Smith-son, Werner A. Stahel, Alec Stephenson, Mark Stevenson, Matthias Templ, Terry Th-erneau, Yves Tille, Adrian Trapletti, Joshua Ulrich, Kevin Ushey, Jeremy VanDerWal, Bill Ven-ables, John Verzani, Gregory R. Warnes, Stefan Wellek, Hadley Wickham, Rand R. Wilcox, Pe-ter Wolf, Daniel Wollschlaeger, Thomas Yee, Achim Zeileis

    Maintainer Andri Signorell

    Description A collection of miscellaneous basic statistic functions and convenience wrappers for effi-ciently describing data. The author's intention was to create a toolbox, which facilitates the (no-toriously time consuming) first descriptive tasks in data analysis, consisting of calculating de-scriptive statistics, drawing graphical summaries and reporting the results. The package con-tains furthermore functions to produce documents using MS Word (or PowerPoint) and func-tions to import data from Excel. Many of the included functions can be found scat-tered in other packages and other sources written partly by Titans of R. The reason for collect-

    1

  • 2 R topics documented:

    ing them here, was primarily to have them consolidated in ONE instead of dozens of pack-ages (which themselves might depend on other packages which are not needed at all), and to pro-vide a common and consistent interface as far as function and arguments naming, NA han-dling, recycling rules etc. are concerned. Google style guides were used as naming rules (in ab-sence of convincing alternatives). The 'camel style' was consequently applied to functions bor-rowed from contributed R packages as well.

    Suggests RDCOMClient, tcltkDepends base, stats, R (>= 3.3.0)Imports graphics, grDevices, methods, MASS, utils, boot, manipulate,

    mvtnorm, foreign, expm, Rcpp (>= 0.12.10)

    LinkingTo Rcpp, BHLicense GPL (>= 2)LazyLoad yesLazyData yesAdditional_repositories http://www.stats.ox.ac.uk/pub/RWin/SystemRequirements C++11NeedsCompilation yesRepository CRANDate/Publication 2018-03-19 08:38:21 UTC

    R topics documented:DescTools-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Abind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24AddMonths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25AddMonthsYM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26Agree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27AllDuplicated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28AndersonDarlingTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Append . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Arrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33as.matrix.xtabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34AscToChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Asp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Association measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Assocs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Atkinson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41AUC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42AxisBreak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43axTicks.POSIXct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44BarnardTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45BartelsRankTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48BarText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

  • R topics documented: 3

    Base Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Benford . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Between, Outside . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54BinomCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56BinomDiffCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58BinomRatioCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60BinTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62BootCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64BoxCox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65BoxCoxLambda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66BoxedText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67BreslowDayTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69BreuschGodfreyTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71BrierScore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73BubbleLegend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76CartToPol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77CatTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78CCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Clockwise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82Closest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Coalesce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84CochranArmitageTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85CochranQTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87CoefVar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89CohenD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90CohenKappa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92CollapseTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94ColorDlg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96ColorLegend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97ColPicker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99ColToGrey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100ColToHex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101ColToHsv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102ColToRgb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103ColumnWrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104CombPairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105ConDisPairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Conf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107ConnLines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110ConoverTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Contrasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114Cor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115CorPart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118CorPolychor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119CountCompCases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121CourseData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122CramerVonMisesTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

  • 4 R topics documented:

    CronbachAlpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Cstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126CutQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127d.countries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128d.diamonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129d.periodic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130d.pizza . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132d.whisky . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133Datasets for Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Date Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135day.name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138DegToRad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139DenseRank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Desc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140DescTools Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148DescTools Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148DescToolsOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150DigitSum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153DivCoef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154DivCoefMax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155DoCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157DrawArc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158DrawBand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159DrawBezier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160DrawCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161DrawEllipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163DrawRegPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Dummy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167DunnettTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168DunnTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170DurbinWatsonTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Entropy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Eps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177ErrBars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178EtaSq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179ExpFreq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181Extremes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182ExtrVal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184Factorize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185FctArgs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186Fibonacci . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187FileOpenCmd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188FindColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189FindCorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191FisherZ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192FixToTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Frac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

  • R topics documented: 5

    Frechet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200Freq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201GCD, LCM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203GenExtrVal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204GenPareto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205GeomTrans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207GetCurrWrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208GetNewWrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209GetNewXL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211Gini . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212GiniSimpson . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214Gmean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215Gompertz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217GoodmanKruskalGamma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218GoodmanKruskalTau . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220GTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222Gumbel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224Herfindahl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225HexToCol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226HexToRgb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228Hmean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228HmsToSec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230HodgesLehmann . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231HoeffD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232HosmerLemeshowTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234HotellingsT2Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235HuberM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237ICC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238identify.formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241IdentifyA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242ImportFileDlg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243InDots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244IsDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244IsDichotomous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245IsEuclid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246IsOdd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247IsPrime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248IsValidWrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249JarqueBeraTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249JonckheereTerpstraTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251KappaM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253KendallTauA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255KendallTauB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256KendallW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260KrippAlpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261Label, Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262Lambda . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

  • 6 R topics documented:

    Lc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265LehmacherTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269LeveneTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270LillieTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272lines.lm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274lines.loess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275LineToUser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277LinScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278List Variety Of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279LOCF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280LOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281Logit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282LogSt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285MAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286Mar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287matpow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289MeanAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290MeanCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291MeanDiffCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293MeanSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295Measures of Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296Measures of Shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299Median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301MedianCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303MHChisqTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304Midx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305MixColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307MosesTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308MoveAvg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310MultinomCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311NemenyiTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313NPV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315OddsRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318ORToRelRisk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320Outlier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321PageTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322PairApply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325ParseFormula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327ParseSASDatalines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328PartitionBy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330PasswordDlg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331PDFManual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332PearsonTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332PercTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334

  • R topics documented: 7

    Permn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337Phrase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339PlotACF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340PlotArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341PlotBag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343PlotBubble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346PlotCandlestick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348PlotCirc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350PlotCorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351PlotDev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353PlotDot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354PlotECDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357PlotFaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359PlotFdist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361PlotFun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364PlotLinesA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366PlotLog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368PlotMarDens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369PlotMiss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371PlotMonth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372PlotMosaic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373PlotMultiDens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374PlotPch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376PlotPolar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377PlotPyramid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380PlotQQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383PlotTernary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384PlotTreemap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385PlotVenn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387PlotViolin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389PlotWeb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391PoissonCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393PolarGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394PostHocTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395power.chisq.test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398PowerPoint Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400pRevGumbel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403PseudoR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404PtInPoly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406Quantile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408Recode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409Recycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411RelRisk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412Rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413reorder.factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415Rev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416

  • 8 R topics documented:

    RevWeibull . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417RgbToCol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419RndPairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420RobScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421RomanToInt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423RoundTo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424RunsTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426SampleTwins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429SaveAsDlg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431ScheffeTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431SD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433SelectVarDlg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434SetAlpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436SetNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437Shade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438ShapiroFranciaTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439SiegelTukeyTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440SignTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443SmoothSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446Some . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448Some numeric checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449SomersDelta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452SortMixed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454SpearmanRho . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456split.formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458SplitAt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459SplitPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460SpreadOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461Stamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462StdCoef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463Str . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465StrAbbr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466StrAlign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467Strata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468StrCap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470StrChop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471StrCountW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472StrDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473StrExtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475StrIsNumeric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476StrLeft, StrRight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477StrPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478StrPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479StrRev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480StrTrim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480StrTrunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481

  • R topics documented: 9

    StrVal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482StuartMaxwellTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484StuartTauC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485SysInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487TextContrastColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487TextToTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489TheilU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490TitleRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491TMod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492ToLong, ToWide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493TOne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495ToWrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497Trim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500TTestA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501TukeyBiweight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503UncertCoef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504UnitConv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506Untable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508Unwhich . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510VarCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511VarTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512VecRot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514VIF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515Vigenere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517VonNeumannTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518wdConst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519Winsorize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520WoolfTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521WrdCaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522WrdCellRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523WrdFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524WrdFormatCells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525WrdInsertBookmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527WrdMergeCells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528WrdParagraphFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529WrdPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531WrdStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533WrdTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534WrdTableBorders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535XLDateToPOSIXct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536XLGetRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537XLView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539Xplore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541YuenTTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542ZeroIfNA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544Zodiac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545ZTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546%like% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548

  • 10 DescTools-package

    %nin% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549%overlaps% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550%c% . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

    Index 553

    DescTools-package Tools for Descriptive Statistics and Exploratory Data Analysis

    Description

    A collection of miscellaneous basic statistic functions and convenience wrappers for efficiently de-scribing data. The authors intention was to create a toolbox, which facilitates the (notoriously timeconsuming) first descriptive tasks in data analysis, consisting of calculating descriptive statistics,drawing graphical summaries and reporting the results. The package contains furthermore func-tions to produce documents using MS Word (or PowerPoint) and functions to import data fromExcel.Many of the included functions can be found scattered in other packages and other sources writtenpartly by Titans of R. The reason for collecting them here, was primarily to have them consolidatedin ONE instead of dozens of packages (which themselves might depend on other packages whichare not needed at all), and to provide a common and consistent interface as far as function and ar-guments naming, NA handling, recycling rules etc. are concerned. Google style guides were used asnaming rules (in absence of convincing alternatives). The CamelStyle was consequently appliedto functions borrowed from contributed R packages as well.

    Feedback, feature requests, bugreports and other suggestions are welcome! Please report problemsto Stack Overflow mentioning DescTools or directly to the maintainer.

    Details

    A grouped list of the functions:

    Operators, calculus, transformations:%()% Between operators determine if a value lies within a range [a,b]%)(% Outside operators: %)(%, %](%, %)[%, %][%%nin% "not in" operator%overlaps% Do two collections have common elements?%like%, %like any% Simple operator to search for a specified pattern%^% Calculate powers of matricesInterval Calculate the number of days of the overlapping part

    of two date periodsAUC Calculate area under the curvePrimes Find all primes less than nFactorize Prime factorization of integersGCD Calculate the greatest common divisorLCM Calculate the least common multiple

  • DescTools-package 11

    Permn Determine all possible permutations of a setFibonacci Generates single Fibonacci numbers or a Fibonacci sequenceDigitSum Digit sum of a numberFrac Return the fractional part of a numeric valueNdec Count decimal places of a numberMaxDigits Maximum used digits for a vector of numbersPrec Precision of a numberBoxCox, BoxCoxInv Box Cox transformation and its inverse transformationBoxCoxLambda Return the optimal lambda for a BoxCox transformationLogSt, LogStInv Calculate started logarithmic transformation and its inverseLogit, LogitInv Generalized logit and inverse logit functionLinScale Simple linear scaling of a vector xWinsorize Data cleaning by winsorizationTrim Trim data by omitting outlying observationsCutQ Cut a numeric variable into quartiles or other quantilesRecode Recode a factor with altered levelsRename Change name(s) of a named objectSort Sort extension for matrices and data.framesSortMixed, OrderMixed Mixed sort orderDenseRank Calculate ranks in consecutive order (no ties)PercentRank Calculate the percent rankRoundTo Round to a multipleLarge, Small Returns the kth largest, resp. smallest valuesHighLow Combines Large and Small.Rev Reverses the order of rows and/or columns of a matrix or a data.frameUntable Recreates original list based on a n-dimensional frequency tableCollapseTable Collapse some rows/columns in a table.Dummy Generate dummy codes for a factorFisherZ, FisherZInv Fishers z-transformation and its inverseMidx Calculate sequentially the midpoints of the elements of a vectorUnitConv Return the most common unit conversionsUnwhich Inverse function to which, create a logical vector/matrix from indicesVigenere Implements a Vigenere cypher, both encryption and decryptionBinTree, PlotBinTree Create and plot a binary tree structure with a given length

    Information and manipulation functions:AllDuplicated Find all values involved in tiesClosest Return the value in a vector being closest to a given oneCoalesce Return the first value in a vector not being NAZeroIfNA, NAIfZero Replace NAs by 0, resp. vice versaImpute Replace NAs by the median or another valueLOCF Imputation of datapoints following the "last observation

    carried forward" ruleCombN Returns the number of subsets out of a list of elementsCombSet Generates all possible subsets out of a list of elementsCombPairs Generates all pairs out of one or two sets of elementsSampleTwins Create sample using stratifying groups

  • 12 DescTools-package

    RndPairs Create pairs of correlated random numbersRndWord Produce random combinations of charactersIsNumeric Check a vector for being numeric, zero Or a whole numberIsWhole Is x a whole number?IsDichotomous Check if x contains exactly 2 valuesIsOdd Is x even or odd?IsPrime Is x a prime number?IsZero Is numeric(x) == 0, say x < machine.eps?IsEuclid Check if a distance matrix is euclideanLabel, Unit Get or set the label, resp. unit, attribute of an objectAbind Bind matrices to n-dimensional arraysAppend Append elements to several classes of objectsVecRot, VecShift Shift the elements of a vector in a circular mode to the right

    or to the left by n characters.Clockwise Transform angles from counter clock into clockwise modesplit.formula A formula interface for the base function splitreorder.factor Reorder the levels of a factorLookup Simple lookup if merge seems cumbersomeToLong, ToWide Simple reshaping of a vectorSetNames Set the names, rownames or columnnames in an object and return itSome Return some randomly chosen elements of an objectSplitAt Split a vector into several pieces at given positionsSplitPath Split a path string in drive, path, filenameStr Compactly display the structure of any R objectTextToTable Converts a string to a table

    String functions:StrCountW Count the words in a stringStrTrim Delete white spaces from a stringStrTrunc Truncate string on a given length and add ellipses if it really

    was truncatedStrLeft, StrRight Returns the left/right part or the a string.StrAlign Align strings to the left/right/center or to a given characterStrAbbr Abbreviates a stringStrCap Capitalize the first letter of a stringStrPad Fill a string with defined characters to fit a given lengthStrRev Reverse a stringStrChop Split a string by a fixed number of characters.StrExtract Extract a part of a string, defined as regular expression.StrVal Extract numeric values from a stringStrIsNumeric Check whether a string does only contain numeric dataStrPos Find position of first occurrence of a string in another oneStrDist Compute Levenshtein or Hamming distance between stringsFixToTable Create table out of a running text, by using columns of spaces as delimiter

    Conversion functions:

  • DescTools-package 13

    AscToChar, CharToAsc Converts ASCII codes to characters and vice versaDecToBin, BinToDec Converts numbers from binmode to decimal and vice versaDecToHex, HexToDec Converts numbers from hexmode to decimal and vice versaDecToOct, OctToDec Converts numbers from octmode to decimal and vice versaDegToRad, RadToDeg Convert degrees to radians and vice versaCartToPol, PolToCart Transform cartesian to polar coordinates and vice versaCartToSph, SphToCart Transform cartesian to spherical coordinates and vice versaRomanToInt Convert roman numerals to integersRgbToLong, LongToRgb Convert a rgb color to a long number and vice versaColToGray, ColToGrey Convert colors to grey/grayscale

    Colors:SetAlpha Add transperancy (alpha channel) to a color.ColorDlg Display the systems color dialog to choose a colorColPicker Display R colors in a dialogColorLegend Add a color legend to a plotColToGray, ColToGrey Convert colors to gcrey/grayscaleColToHex, HexToCol Convert a color into hex stringHexToRgbColToHsv R color to HSV conversionColToRgb, RgbToCol Color to RGB conversion and backFindColor Get color on a defined color rangeMixColor Get the mix of two colorsTextContrastColor Choose textcolor depending on background colorPal Some custom color palettes

    Plots:Canvas Canvas for geometric plottingMar Set margins more comfortably.Asp Return aspect ratio of the current plotLineToUser Convert line coordinates to user coordinateslines.loess Add a loess smoother and its CIs to an existing plotlines.lm Add the prediction of linear model and its CIs to a plotlines.smooth.spline Add the prediction of a smooth.spline and its CIs to a plotBubbleLegend Add a legend for bubbles to a bubble plotTitleRect Add a main title to a plot surrounded by a rectangular boxBarText Add the value labels to a barplotErrBars Add horizontal or vertical error bars to an existing plotDrawArc, DrawRegPolygon Draw elliptic, circular arc(s) or regular polygon(s)DrawCircle, DrawEllipse Draw a circle, a circle annulus or a sector or an annulusDrawBezier Draw a Bezier curveDrawBand Draw confidence bandBoxedText Add text surrounded by a box to a plotRotate Rotate a geometric structureSpreadOut Spread out a vector of numbers so that there is a minimum

    interval between any two elements. This can be used

  • 14 DescTools-package

    to place textlabels in a plot so that they do not overlap.IdentifyA Helps identifying all the points in a specific area.identify.formula Formula interface for identify.PtInPoly Identify all the points within a polygon.ConnLines Calculate and insert connecting lines in a barplotAxisBreak Place a break mark on an axisPlotACF, PlotGACF Create a combined plot of a time series including its

    autocorrelation and partial autocorrelationPlotMonth Plot seasonal effects of a univariate time seriesPlotArea Create an area plotPlotBag Create a two-dimensional boxplotPlotBagPairs Produce pairwise 2-dimensional boxplots (bagplot)PlotBubble Draw a bubble plotPlotCandlestick Plot candlestick chartPlotCirc Create a circular plotPlotCorr Plot a correlation matrixPlotDot Plot a dotchart with confidence intervalsPlotFaces Produce a plot of Chernoff facesPlotFdist Frequency distribution plot, combination of histogram,

    boxplot and ecdf.plotPlotMarDens Scatterplot with marginal densitiesPlotMultiDens Plot multiple density curvesPlotPolar Plot values on a circular gridPlotFun Plot mathematical expression or a functionPolarGrid Plot a grid in polar coordinatesPlotPyramid Pyramid plot (back-back histogram)PlotTreemap Plot of a treemap.PlotVenn Plot a Venn diagramPlotViolin Plot violins instead of boxplotsPlotQQ QQ-plot for an optional distributionPlotWeb Create a web plotPlotTernary Create a triangle or ternary plotPlotMiss Plot missing valuesPlotDev Simple convenience wrapper for producing TIF-FilesPlotECDF Plot empirical cumulative distribution functionPlotLinesA Plot the columns of one matrix against the columns of anotherPlotLog Create a plot with logarithmic axis and log gridPlotMosaic Plots a mosaic describing a contingency table in array formShade Produce a shaded curveStamp Stamp the current plot with Date/Time/Directory or any other expression

    Distributions:_Benf Benford distribution, including qBenf, dBenf, rBenf_ExtrVal Extreme value distribution (dExtrVal)_Frechet Frechet distribution (dFrechet)_GenExtrVal Generalized Extreme Value Distribution (dGenExtrVal)_GenPareto Generalized Pareto Distribution (dGenPareto)

  • DescTools-package 15

    _Gompertz Gompertz distribution (dGompertz)_Gumbel Gumbel distribution (dRevGumbel)_NegWeibull Negative Weibull distribution (dRevWeibull)_Order Distributions of Order Statistics (dOrder)_RevGumbel Reverse Gumbel distribution (dRevGumbel),_RevGumbelExp Expontial reverse Gumbel distribution (quantile only)_RevWeibull Reverse Weibull distribution (dRevWeibull)

    Statistics:Freq Univariate frequency tablePercTable Bivariate percentage tableMargins (Extended) margin tables of a tableExpFreq Expected frequencies of a n-dimensional tableMode Mode, the most frequent valueGmean, Gsd Geometric mean and geometric standard deviationHmean Harmonic MeanMedian Extended median function supporting weights and ordered factorsHuberM, TukeyBiweight Huber M-estimator of location and Tukeys biweight robust meanHodgesLehmann the Hodges-Lehmann estimatorHoeffD Hoeffdings D statisticMeanSE Standard error of meanMeanCI, MedianCI Confidence interval for the mean and medianMeanDiffCI Confidence interval for the difference of two meansMoveAvg Moving averageMeanAD Mean absolute deviationVarCI Confidence interval for the varianceCoefVar Coefficient of variation and its confidence intervalRobScale Robust data standardizationRange (Robust) rangeBinomCI, MultinomCI Confidence intervals for binomial and multinomial proportionsBinomDiffCI Calculate confidence interval for a risk differenceBinomRatioCI Calculate confidence interval for the ratio of binomial proportions.PoissonCI Confidence interval for a Poisson lambdaSkew, Kurt Skewness and kurtosisYuleQ, YuleY Yules Q and Yules YTschuprowT Tschuprows TPhi, ContCoef, CramerV Phi, Pearsons Contingency Coefficient and Cramers VGoodmanKruskalGamma Goodman Kruskals gammaKendallTauA Kendalls tau-aKendallTauB Kendalls tau-bStuartTauC Stuarts tau-cSomersDelta Somers deltaLambda Goodman Kruskals lambdaGoodmanKruskalTau Goodman Kruskals tauUncertCoef Uncertainty coefficientEntropy, MutInf Shannons entropy, mutual informationDivCoef, DivCoefMax Raos diversity coefficient ("quadratic entropy")

  • 16 DescTools-package

    TheilU Theils U1 and U2 coefficientAssocs Combines the association measures above.OddsRatio, RelRisk Odds ratio and relative riskORToRelRisk Transform odds ratio to relative riskCohenKappa, KappaM Cohens Kappa, weighted Kappa and Kappa for

    more than 2 ratersCronbachAlpha Cronbachs alphaICC Intraclass correlationsKrippAlpha Return Kripps alpha coefficientKendallW Compute the Kendall coefficient of concordanceLc Calculate and plot Lorenz curveGini, Atkinson Gini- and Atkinson coefficientHerfindahl, Rosenbluth Herfindahl- and Rosenbluth coefficientGiniSimpson Compute Gini-Simpson CoefficientCorCI Confidence interval for Pearsons correlation coefficientCorPart Find the correlations for a set x of variables with set y removedCorPolychor Polychoric correlation coefficientSpearmanRho Spearman rank correlation and its confidence intervalsConDisPairs Return concordant and discordant pairs of two vectorsFindCorr Determine highly correlated variablesCohenD Cohens Effect SizeEtaSq Effect size calculations for ANOVAsContrasts Generate pairwise contrasts for using in a post-hoc testStrata Stratified sampling with equal/unequal probabilitiesOutlier Outliers following Tukeys boxplot definitionLOF Local outlier factorBrierScore Brier score, assessing the quality of predictions of binary eventsCstat C statistic, equivalent to the area under the ROC curve)CCC Lins concordance correlation coef for agreement on a continuous measureMAE, MAPE Mean absolute error and ean absolute percentage errorMSE, RMSE Mean squared error and root mean squared errorNMAE, NMSE Normalized mean absolute and mean squared errorConf Confusion matrix, a cross-tabulation of observed and predicted classes

    with associated statisticsSens, Spec Sensitivity and specificityPseudoR2 Variants of pseudo R squared statistics: McFadden, Aldrich-Nelson,

    Nagelkerke, CoxSnell, Effron, McKelvey-Zavoina, TjurMean, SD, Var Variants of base statistics, allowing to define weights: Mean,Quantile, MAD, Cor standard deviation, variance, quantile, mad, correlationVIF, StdCoef Variance inflationary factors and standardised coefficents for linear models

    Tests:SignTest Signtest to test whether two groups are equally sizedZTest Ztest for known population varianceJonckheereTerpstraTest Jonckheere-Terpstra trend test for mediansPageTest Page test for ordered alternativesCochranQTest Cochrans Q-test

  • DescTools-package 17

    SiegelTukeyTest Siegel-Tukey test for equality in variabilitySiegelTukeyRank Calculate Siegel-Tukeys ranks (auxiliary function)LeveneTest Levenes test for homogeneity of varianceMosesTest Moses Test of extreme reactionsRunsTest Runs test for randomnessDurbinWatsonTest Durbin-Watson test for autocorrelationBartelsRankTest Bartels rank test for randomnessJarqueBeraTest Jarque-Bera Test for normalityAndersonDarlingTest Anderson-Darling test for normalityCramerVonMisesTest Cramer-von Mises test for normalityLillieTest Lilliefors (Kolmogorov-Smirnov) test for normalityPearsonTest Pearson chi-square test for normalityShapiroFranciaTest Shapiro-Francia test for normalityMHChisqTest Mantel-Haenszel Chisquare testStuartMaxwellTest Stuart-Maxwell marginal homogeneity testLehmacherTest Lehmacher marginal homogeneity testCochranArmitageTest Cochran-Armitage test for trend in binomial proportionsBreslowDayTest, WoolfTest Test for homogeneity on 2x2xk tables over strataPostHocTest Post hoc tests by Scheffe, LSD, Tukey for a aov-objectScheffeTest Multiple comparisons Scheffe testDunnTest Dunns test of multiple comparisonsDunnettTest Dunnetts test of multiple comparisonsHotellingsT2Test Hotellings T2 test for the one and two sample case.YuenTTest Yuens robust t-Test with trimmed means and winsorized variancesBarnardTest Barnards test for 2x2 tablesBreuschGodfreyTest Breusch-Godfrey test for higher-order serial correlation.ConoverTest Conovers test of multiple comparisons (following a kruskal test)GTest Perform chi-squared contingency table test and goodness-of-fit test.HosmerLemeshowTest Hosmer-Lemeshow goodness of fit testsNemenyiTest Nemenyis test of multiple comparisons.TTestA Students t-test based on sample statisticsVarTest ChiSquare test for one variance and F test for two variancesVonNeumannTest Von Neumanns successive difference test

    Date functions:day.name, day.abb Defined names of the daysAddMonths, AddMonthsYM Add a number of months to a given dateIsDate Check whether x is a date objectIsWeekend Check whether x falls on a weekendIsLeapYear Check whether x is a leap yearLastDayOfMonth Return the last day of the month of the date xDiffDays360 Calculate the difference of two dates using the 360-days systemDate Create a date from numeric representation of year, month, dayDay, Month, Year Extract part of a dateHour, Minute, Second Extract part of timeWeek, Weekday Returns ISO week and weekday of a dateQuarter Quarter of a date

  • 18 DescTools-package

    Timezone Timezone of a POSIXct/POSIXlt dateYearDay, YearMonth The day in the year of a dateNow, Today Get current date or date-timeHmsToSec, SecToHms Convert h:m:s times to seconds and vice versaOverlap Determine if and how extensively two date ranges overlapZodiac The zodiac sign of a date :-)

    Finance functions:OPR One period returns (simple and log returns)NPV Net present valueNPVFixBond Net present value for fix bondsIRR Internal rate of returnYTM Return yield to maturity for a bond

    GUI-Helpers:FileOpenCmd Get path of a data file to be openedImportFileDlg Dialog for importing SPSS, Stata, SAS, Minitab or Systat filesSaveAsDlg Save a data object by dialogModelDlg Helps to compose a model formula in a dialogSelectVarDlg Select elements of a set by clickPasswordDlg Display a dialog containing an edit field, showing only ***.PlotPar Display the R plot parameters in a dialogPlotPch Plot point characters for informationXplore A breeze of interactive plotting

    Reporting, InOut:CatTable Print a table with the option to have controlled linebreaksFormat, Fmt Easy format for numbers and datesDesc Produce a rich description of an objectAbstract Display compact overview of the structure of a data frameTMod Create comparison table for (general) linear modelsTOne Create "Table One"" describing baseline characteristicsGetNewWrd, GetNewXL, GetNewPP Create a new Word, Excel or PowerPoint InstanceGetCurrWrd, GetCurrXL, GetCurrPP Get a handle to a running Word, Excel or PowerPoint instanceWrdKill, XLKill Ends a (possibly hidden) Word/Excel processIsValidWrd Check if the handle to a Word instance is valid or outdatedWrdCaption Insert a title in WordWrdFont Get and set the font for the current selection in WordWrdParagraphFormat Get and set the paragraph formatWrdTable Create a table in WordWrdCellRange Select a cell range of a table in WordWrdMergeCells Merge cells of a table in WordWrdFormatCells Format selected cells of a table in wordWrdTableBorders Set or edit table border style of a table in WordToWrd Mord flexible wrapper to send diverse objects to Word

  • DescTools-package 19

    WrdPlot Insert the active plot to WordWrdInsertBookmark Insert a new bookmark in a Word documentWrdGoto Place cursor to a specific bookmark, or another text position.WrdUpdateBookmark Update the text of a bookmarks rangeWrdStyle Get and set the style of a paragraph in WordXLDateToPOSIXct Convert XL-Date format to POSIXct formatXLGetRange Get the values of one or several cell range(s) in ExcelXLGetWorkbook Get the values of all sheets of an Excel workbookXLView Use Excel as viewer for a data.framePpPlot Insert active plot to PowerPointPpAddSlide Adds a slide to a PowerPoint presentationPpText Adds a textbox with text to a PP-presentationParseSASDatalines Parse a SAS "datalines" statement to read data

    Tools:PairApply Helper for calculating functions pairwiseLsFct, LsObj List the functions (or the data, all objects) of a packageFctArgs Retrieve the arguments of a functionsInDots Check if an argument is contained in ... argument and return its valueParseFormula Parse a formula and return the splitted parts of ifRecycle Recycle a list of elements to the maximal found dimensionKeywords Get the keywords of a man pageSysInfo Get some more information about system and environmentDescToolsOptions Get the DescTools specific optionsPDFManual Get the pdf-manual of any package on CRAN and open it

    Warning

    This package is still under development. Although the code seems meanwhile quite stable, untilrelease of version 1.0 (which is expected in, ... ok, I think were ready: spring 2018) you should beaware that everything in the package might be subject to change. Backward compatibility is not yetguaranteed. Functions may be deleted or renamed and new syntax may be inconsistent with earlierversions. By release of version 1.0 the "deprecated-defunct process" will be installed.

    MS-Office

    To make use of MS-Office features you must have Office in one of its variants installed. All Wrd*,XL* and Pp* functions require as well the package RDCOMClient to be installed. Hence the useof these functions is restricted to Windows systems. RDCOMClient is available at:http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/ and can be installed withinstall.packages("RDCOMClient", repos="http://www.stats.ox.ac.uk/pub/RWin")RDCOMClient does not exist for Mac or Linux, sorry.

    http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/

  • 20 Abind

    Author(s)

    Andri SignorellHelsana Versicherungen AG, Health Sciences, ZurichHWZ University of Applied Sciences in Business Administration Zurich.

    Includes R source code and/or documentation previously published by (in alphabetical order):Ken Aho, Nanina Anderegg, Tomas Aragon, Antti Arppe, Adrian Baddeley, Kamil Barton, BenBolker, Frederico Caeiro, Stephane Champely, Daniel Chessel, Leanne Chhay, Clint Cummins,Michael Dewey, Harold C. Doran, Stephane Dray, Charles Dupont, Dirk Eddelbuettel, Jeff Enos,Claus Ekstrom, Martin Elff, Kamil Erguler, Richard W. Farebrother, John Fox, Romain Francois,Michael Friendly, Tal Galili, Matthias Gamer, Joseph L. Gastwirth, Yulia R. Gel, Juergen Gross,Gabor Grothendieck, Frank E. Harrell Jr, Richard Heiberger, Michael Hoehle, Christian W. Hoff-mann, Torsten Hothorn, Markus Huerzeler, Wallace W. Hui, Pete Hurd, Rob J. Hyndman, Pablo J.Villacorta Iglesias, Christopher Jackson, Matthias Kohl, Mikko Korpela, Max Kuhn, Detlew Labes,Friederich Leisch, Jim Lemon, Dong Li, Martin Maechler, Arni Magnusson, Daniel Malter, GeorgeMarsaglia, John Marsaglia, Alina Matei, David Meyer, Weiwen Miao, Giovanni Millo, Yongyi Min,David Mitchell, Markus Naepflin, Daniel Navarro, Henric Nilsson, Klaus Nordhausen, Derek Ogle,Hong Ooi, Nick Parsons, Sandrine Pavoine, Tony Plate, Roland Rapold, William Revelle, TylerRinker, Brian D. Ripley, Caroline Rodriguez, Nathan Russell, Venkatraman E. Seshan, Greg Snow,Michael Smithson, Werner A. Stahel, Alec Stephenson, Mark Stevenson, Terry Therneau, YvesTille, Adrian Trapletti, Kevin Ushey, Jeremy VanDerWal, Bill Venables, John Verzani, GregoryR. Warnes, Stefan Wellek, Hadley Wickham, Rand R. Wilcox, Peter Wolf, Daniel Wollschlaeger,Thomas Yee, Achim Zeileis

    Special thanks go to Beat Bruengger, Mathias Frueh, Daniel Wollschlaeger for their valuable con-tributions and testing.

    Without you I wouldnt be where I am. Thank you all!The good things come from all these guys, any problems are likely due to my tweaking.

    Maintainer: Andri Signorell

    Examples

    # ******************************************************# There are no examples defined here. But see the demos:## demo(describe)# demo(plots))## ******************************************************

    Abind Combine Multidimensional Arrays

    Description

    Base R functions cbind and rbind bind columns and rows, but theres no built-in function for bind-ing higher dimensional datastructures like matrices. Abind takes a sequence of vectors, matrices,or arrays and produces a single array of the same or higher dimension.

  • Abind 21

    Usage

    Abind(..., along = N, rev.along = NULL, new.names = NULL, force.array = TRUE,make.names = FALSE, use.first.dimnames = FALSE, hier.names = FALSE,use.dnns = FALSE)

    Arguments

    ... Any number of vectors, matrices, arrays, or data frames. The dimensions of allthe arrays must match, except on one dimension (specified by along=). If thesearguments are named, the name will be used for the name of the dimensionalong which the arrays are joined. Vectors are treated as having a dim attributeof length one.

    Alternatively, there can be one (and only one) list argument supplied, whosecomponents are the objects to be bound together. Names of the list componentsare treated in the same way as argument names.

    along The dimension along which to bind the arrays. The default is the last dimension,i.e., the maximum length of the dim attribute of the supplied arrays. along= cantake any non-negative value up to the minimum length of the dim attribute ofsupplied arrays plus one. When along= has a fractional value, a value less than1, or a value greater than N (N is the maximum of the lengths of the dim attributeof the objects to be bound together), a new dimension is created in the result. Inthese cases, the dimensions of all arguments must be identical.

    rev.along Alternate way to specify the dimension along which to bind the arrays: along = N + 1 - rev.along.This is provided mainly to allow easy specification of along = N + 1 (by sup-plying rev.along=0). If both along and rev.along are supplied, the suppliedvalue of along is ignored.

    new.names If new.names is a list, it is the first choice for the dimnames attribute of theresult. It should have the same structure as a dimnames attribute. If the namesfor a particular dimension are NULL, names for this dimension are constructed inother ways.

    If new.names is a character vector, it is used for dimension names in the sameway as argument names are used. Zero length ("") names are ignored.

    force.array If FALSE, rbind or cbind are called when possible, i.e., when the arguments areall vectors, and along is not 1, or when the arguments are vectors or matrices ordata frames and along is 1 or 2. If rbind or cbind are used, they will preserve thedata.frame classes (or any other class that r/cbind preserve). Otherwise, Abindwill convert objects to class array. Thus, to guarantee that an array object isreturned, supply the argument force.array=TRUE. Note that the use of rbind orcbind introduces some subtle changes in the way default dimension names areconstructed: see the examples below.

    make.names If TRUE, the last resort for dimnames for the along dimension will be the deparsedversions of anonymous arguments. This can result in cumbersome names whenarguments are expressions.

    The default is FALSE.

  • 22 Abind

    use.first.dimnames

    When dimension names are present on more than one argument, should dimen-sion names for the result be take from the first available (the default is to takethem from the last available, which is the same behavior as rbind and cbind.)

    hier.names If TRUE, dimension names on the concatenated dimension will be composed ofthe argument name and the dimension names of the objects being bound. If asingle list argument is supplied, then the names of the components serve as theargument names. hier.names can also have values "before" or "after"; thesedetermine the order in which the argument name and the dimension name areput together (TRUE has the same effect as "before").

    use.dnns (default FALSE) Use names on dimensions, e.g., so that names(dimnames(x)) isnon-empty. When there are multiple possible sources for names of dimnames,the value of use.first.dimnames determines the result.

    Details

    The dimensions of the supplied vectors or arrays do not need to be identical, e.g., arguments can bea mixture of vectors and matrices. Abind coerces arguments by the addition of one dimension inorder to make them consistent with other arguments and along=. The extra dimension is added inthe place specified by along=.

    The default action of Abind is to concatenate on the last dimension, rather than increase the numberof dimensions. For example, the result of calling Abind with vectors is a longer vector (see firstexample below). This differs from the action of rbind and cbind which is to return a matrix whencalled with vectors. Abind can be made to behave like cbind on vectors by specifying along=2, andlike rbind by specifying along=0.

    The dimnames of the returned object are pieced together from the dimnames of the arguments, andthe names of the arguments. Names for each dimension are searched for in the following order:new.names, argument name, dimnames (or names) attribute of last argument, dimnames (or names)attribute of second last argument, etc. (Supplying the argument use.first.dimnames=TRUE changesthis to cause Abind to use dimnames or names from the first argument first. The default behavioris the same as for rbind and cbind: use dimnames from later arguments.) If some names are sup-plied for the along dimension (either as argument names or dimnames in arguments), names areconstructed for anonymous arguments unless maken.ames=FALSE.

    Value

    An array with a dim attribute calculated as follows.

    Let rMin=min(sapply(list(...), function(x) length(dim(x)))) andrMax=max(sapply(list(...), function(x) length(dim(x)))) (where the length of the di-mensions of a vector are taken to be 1). Then rMax should be equal to or one greater than rMin.

    If along refers to an existing dimension, then the length of the dim attribute of the result is rMax. Ifalong does not refer to an existing dimension, then rMax should equal rMin and the length of thedim attribute of the result will be rMax+1.

    rbind or cbind are called to compute the result if (a) force.array=FALSE; and (b) the result willbe a two-dimensional object.

  • Abind 23

    Note

    It would be nice to make Abind() an S3 generic, but S3 generics cannot dispatch off anonymousarguments.

    The ability of Abind() to accept a single list argument removes much of the need for constructs likedo.call("Abind", list.of.arrays). Instead, just do Abind(list.of.arrays). The directconstruct is preferred because do.call() construct can sometimes consume more memory duringevaluation.

    Author(s)

    Tony Plate and Richard Heiberger

    See Also

    rbind, cbind, array

    Examples

    # Five different ways of binding together two matricesx

  • 24 Abstract

    Abind(list(x=x, y=x), along=3)# Use lapply(..., get) to get the objectsan

  • AddMonths 25

    Author(s)

    Andri Signorell

    See Also

    str, summary, ColumnWrap

    Examples

    d.mydata

  • 26 AddMonthsYM

    Author(s)

    Andri Signorell , based on code by Roland Rapold and Antonio

    References

    Thanks to Antonio: http://stackoverflow.com/questions/14169620/add-a-month-to-a-date

    See Also

    AddMonthsYM; Date functions: Year, Month, etc.

    Examples

    # characters will be coerced to DateAddMonths("2013-01-31", 1)

    # negative nAddMonths(as.Date("2013-03-31"), -1)

    # Arguments will be recycled# (with warning if the longer is not a multiple of length of shorter)AddMonths(c("2013-01-31", "2013-03-31", "2013-10-31", "2013-12-31"), c(1,-1))

    x

  • Agree 27

    Details

    All parameters will be recyled if necessary. The therefore used function mapply will display awarning, if the longer argument is not a multiple of the length of the shorter one.

    Value

    a vector of class integer with the same dimension as x, containing the transformed dates.

    Author(s)

    Andri Signorell , based on code by Roland Rapold

    See Also

    AddMonths; Date functions, like Year, Month, etc.

    Examples

    AddMonthsYM(201511, 5)

    AddMonthsYM(c(201511, 201302), c(5, 15))AddMonthsYM(c(201511, 201302), c(5, -4))

    Agree Raw Simple And Extended Percentage Agreement

    Description

    Computes raw simple and extended percentage agreement among raters.

    Usage

    Agree(x, tolerance = 0, na.rm = FALSE)

    Arguments

    x a data.frame or a k m matrix, k subjects (in rows) m raters (in columns).tolerance number of successive rating categories that should be regarded as rater agree-

    ment (see details).

    na.rm logical, indicating whether NA values should be stripped before the computationproceeds. If set to TRUE only the complete cases of the ratings will be used.Defaults to FALSE.

    Details

    Using extended percentage agreement (tolerance != 0) is only possible for numerical values. Iftolerance equals 1, for example, raters differing by one scale degree are interpreted as agreeing.

  • 28 AllDuplicated

    Value

    numeric value of coefficient of interrater reliability

    The number of finally (potentially after omitting missing values) used subjects and raters are re-turned as attributes:

    subjects the number of subjects examined.

    raters the number of raters.

    Author(s)

    Matthias Gamer ,some editorial amendments Andri Signorell

    See Also

    CohenKappa, KappaM

    Examples

    categ

  • AllDuplicated 29

    Arguments

    x vector of any type.

    Value

    logical vector of the same dimension as x.

    Author(s)

    Andri Signorell

    See Also

    unique returns a unique list of all values in xduplicated returns an index vector flagging all elements, which appeared more than once (leavingout the first appearance!)union(A, B) returns a list with the unique values from A and Bintersect returns all elements which appear in A and in Bsetdiff(A, B) returns all elements appearing in A but not in Bsetequal(A, B) returns TRUE if A contains exactly the same elements as Bsplit(A, A) returns a list with all the tied values in A (see examples)

    Examples

    x

  • 30 AndersonDarlingTest

    x 1)# count tied groupssum(tab[tab>1])

    AndersonDarlingTest Anderson-Darling Test of Goodness-of-Fit

    Description

    Performs the Anderson-Darling test of goodness-of-fit to a specified continuous univariate proba-bility distribution.

    Usage

    AndersonDarlingTest(x, null = "punif", ..., nullname)

    Arguments

    x numeric vector of data values.

    null a function, or a character string giving the name of a function, to compute thecumulative distribution function for the null distribution.

    ... additional arguments for the cumulative distribution function.

    nullname optional character string describing the null distribution.The default is "uniform distribution".

    Details

    This command performs the Anderson-Darling test of goodness-of-fit to the distribution specifiedby the argument null. It is assumed that the values in x are independent and identically distributedrandom values, with some cumulative distribution function F . The null hypothesis is that F is thefunction specified by the argument null, while the alternative hypothesis is that F is some otherfunction.

  • Append 31

    Value

    An object of class "htest" representing the result of the hypothesis test.

    Author(s)

    Original C code by George Marsaglia and John Marsaglia. R interface by Adrian Baddeley.

    References

    Anderson, T.W. and Darling, D.A. (1952) Asymptotic theory of certain goodness-of-fit criteriabased on stochastic processes. Annals of Mathematical Statistics 23, 193212.

    Anderson, T.W. and Darling, D.A. (1954) A test of goodness of fit. Journal of the American Statis-tical Association 49, 765769.

    Marsaglia, G. and Marsaglia, J. (2004) Evaluating the Anderson-Darling Distribution. Journal ofStatistical Software 9 (2), 15. February 2004. http://www.jstatsoft.org/v09/i02

    See Also

    shapiro.test and all other tests for normality.

    Examples

    x

  • 32 Append

    Arguments

    x object for the elements to be insertedvalues the elements to be insertedafter a subscript, after which the values are to be appended. If its missing the values

    will be appended after the last element (or column/row).rows logical, defining if vector should be added as row or as column. Default is

    column (rows=FALSE).names the dimension names for the inserted elements(s)... further arguments (not used here)

    Details

    The vector x will be recycled to a length of the next multiple of the number of rows (or columns)of the matrix m and will be inserted such that the first inserted row (column) has the index i. If thedimnames are given, they will be used no matter if the matrix m has already dimnames defined ornot.

    Value

    An object containing the values in x with the elements of values appended after the specified elementof x.

    Author(s)

    Andri Signorell

    See Also

    rbind, cbind, append

    Examples

    Append(1:5, 0:1, after = 3) # the same as append

    # Insert columns and rowsx

  • Arrow 33

    Arrow Insert an Arrow Into a Plot

    Description

    Places an arrow into a plot. Two additional arrow heads are implemented.

    Usage

    Arrow(x0, y0, x1, y1, col = par("bg"), border = par("fg"), head = 1,cex = 1, lwd = 1, lty = 1)

    Arguments

    x0, y0 coordinates of points from which to draw.

    x1, y1 coordinates of points to which to draw. At least one must the supplied.

    col the color of the line and background color of the arrow head.

    border color of the arrow head.

    head type of head, can be one out of 1:3.

    cex extension factor for the arrow head.

    lwd line width

    lty line type

    Value

    Nothing returned

    Author(s)

    Andri Signorell

    See Also

    arrows

    Examples

    Canvas()Arrow(1, 1, 0, 0)

  • 34 as.matrix.xtabs

    as.matrix.xtabs Convert xtabs To matrix

    Description

    This function converts an xtabs object to a matrix.

    Usage

    ## S3 method for class 'xtabs'as.matrix(x, ...)

    Arguments

    x an object of class xtabs

    ... additional arguments to be passed to or from methods.

    Details

    An xtabs object is indeed already a matrix, but wont be converted to a pure matrix by as.matrix.defaultfunction, as its class definition will remain unchanged. Some functions expecting a pure matrix mayfail, when fed with a xtabs object. as.matrix.xtabs will drop the classes and the call attribute.Note that unclass would as well discard the classes xtabs and table, but retain the "call" at-tribute.

    Author(s)

    Andri Signorell

    See Also

    as.matrix, xtabs, unclass

    Examples

    tab

  • AscToChar 35

    AscToChar Convert ASCII Codes to Characters and Vice Versa

    Description

    AscToChar returns a character for each ASCII code (integer) supplied.CharToAsc returns integer codes in 0:255 for each (one byte) character in all strings in x.

    Usage

    AscToChar(i)CharToAsc(x)

    Arguments

    i numeric (integer) vector of values in 1:255.

    x vector of strings.

    Details

    Only codes in 1:127 make up the ASCII encoding which should be identical for all R versions,whereas the upper half is often determined from the ISO-8859-1 (aka ISO-Latin 1) encoding,but may well differ, depending on the locale setting, see also Sys.setlocale.

    Note that 0 is no longer allowed since, R does not allow \0 aka nul characters in a string anymore.

    Value

    AscToChar returns a vector of the same length as i. CharToAsc returns a list of numeric vectors ofcharacter length of each string in x.

    Author(s)

    unknown guy out there, help text partly taken from M. Maechlers sfsmisc.

    See Also

    charToRaw

    Examples

    (x

  • 36 Association measures

    # this would be an alternative, but the latter would be of class rawDecToHex(CharToAsc("Silvia"))charToRaw("Silvia")

    Asp Get Aspect Ratio of the Current Plot

    Description

    Returns the aspect ratio of the current plot in user coordinates.

    Usage

    Asp()

    Details

    The aspect ratio of the plot is calculated as

    w

  • Association measures 37

    Usage

    Phi(x, y = NULL, ...)ContCoef(x, y = NULL, correct = FALSE, ...)CramerV(x, y = NULL, conf.level = NA,

    method = c("ncchisq", "ncchisqadj", "fisher", "fisheradj"), ...)

    YuleQ(x, y = NULL, ...)YuleY(x, y = NULL, ...)TschuprowT(x, y = NULL, ...)

    Arguments

    x can be a numeric vector, a matrix or a table.

    y NULL (default) or a vector with compatible dimensions to x. If y is provided,table(x, y, ...) is calculated.

    conf.level confidence level of the interval. This is only implemented for Cramers V. If setto NA (which is the default) no confidence interval will be calculated.See examples for calculating bootstrap intervals.

    method string defining the method to calculate confidence intervals for Cramers V. Oneout of "ncchisq" (using noncentral chisquare), "ncchisqadj", "fisher" (us-ing fisher z transformation), "fisheradj" (using fisher z transformation andbias correction). Default is "ncchisq".

    correct logical. This argument only applies to ContCoef and indicates, whether theSakodas adjusted Pearsons C should be returned. Default is FALSE.

    ... further arguments are passed to the function table, allowing i.e. to set useNA.

    Details

    For x either a matrix or two vectors x and y are expected. In latter case table(x, y, ...) is cal-culated. The function handles NAs the same way the table function does, so tables are by defaultcalculated with NAs omitted.

    A provided matrix is interpreted as a contingency table, which seems in the case of frequencydata the natural interpretation (this is e.g. also what chisq.test expects).

    Use the function PairApply (pairwise apply) if the measure should be calculated pairwise for allcolumns. This allows matrices of association measures to be calculated the same way cor does.NAs are by default omitted pairwise, which corresponds to the pairwise.complete option of cor.Use complete.cases, if only the complete cases of a data.frame are to be used. (see examples)

    The maximum value for Phi is

    (min(r, c) 1). The contingency coefficient goes from 0 to(min(r,c)1min(r,c) ). For the corrected contingency coefficient and for Cramers V the range is 0 to 1.

    A Cramers V in the range of [0, 0.3] is considered as weak, [0.3,0.7] as medium and > 0.7 asstrong. The minimum value for all is 0 under statistical independence.

  • 38 Association measures

    Value

    a single numeric value if no confidence intervals are requested,and otherwise a numeric vector with 3 elements for the estimate, the lower and the upper confidenceinterval

    Author(s)

    Andri Signorell ,Michael Smithson (confidence intervals for Cramer V)

    References

    Yule, G. Uday (1912) On the methods of measuring association between two attributes. Journal ofthe Royal Statistical Society, LXXV, 579-652

    Tschuprow, A. A. (1939) Principles of the Mathematical Theory of Correlation, translated by M.Kantorowitsch. W. Hodge & Co.

    Cramer, H. (1946) Mathematical Methods of Statistics. Princeton University Press

    Agresti, Alan (1996) Introduction to categorical data analysis. NY: John Wiley and Sons

    Sakoda, J.M. (1977) Measures of Association for Multivariate Contingency Tables, Proceedings ofthe Social Statistics Section of the American Statistical Association (Part III), 777-780.

    Smithson, M.J. (2003) Confidence Intervals, Quantitative Applications in the Social Sciences Se-ries, No. 140. Thousand Oaks, CA: Sage. pp. 39-41

    See Also

    table, PlotCorr, PairApply, Assocs

    Examples

    tab

  • Assocs 39

    m

  • 40 Assocs

    Details

    This function wraps the association measures phi, contingency coefficient, Cramers V, GoodmanKruskals Gamma, Kendalls Tau-b, Stuarts Tau-c, Somers Delta, Pearson and Spearman correla-tion, Guttmans Lambda, Theils Uncertainty Coefficient and the mutual information.

    Value

    numeric matrix, dimension [1:17, 1:3]the first column contains the estimate, the second the lower confidence interval, the third the upperone.

    Author(s)

    Andri Signorell

    See Also

    Phi, ContCoef, CramerV, GoodmanKruskalGamma, KendallTauB, StuartTauC, SomersDelta, SpearmanRho,Lambda, UncertCoef, MutInf

    Examples

    # Example taken from: SAS/STAT(R) 9.2 User's Guide, Second Edition, The FREQ Procedure# http://support.sas.com/documentation/cdl/en/statugfreq/63124/PDF/default/statugfreq.pdf# Hair-Eye-Color pp. 1816

    tob

  • Atkinson 41

    Atkinson Atkinson Index - A Measure of Inequality.

    Description

    The Atkinson index is an inequality measure and is useful in determining which end of the distri-bution contributed most to the observed inequality.

    Usage

    Atkinson(x, n = rep(1, length(x)), parameter = 0.5, na.rm = FALSE)

    Arguments

    x a vector containing at least non-negative elements.

    n a vector of frequencies, must be same length as x.

    parameter parameter of the inequality measure (if set to NULL the default parameter of therespective measure is used).

    na.rm logical. Should missing values be removed? Defaults to FALSE.

    Value

    the value of the Akinson Index.

    Note

    This function was previously published as ineq() in the ineq package and has been integrated herewithout logical changes, but with some extensions for NA-handling and the use of weights.

    Author(s)

    Achim Zeileis

    References

    Cowell, F. A. (2000) Measurement of Inequality in Atkinson, A. B. / Bourguignon, F. (Eds): Hand-book of Income Distribution. Amsterdam.

    Cowell, F. A. (1995) Measuring Inequality Harvester Wheatshef: Prentice Hall.

    Marshall, Olkin (1979) Inequalities: Theory of Majorization and Its Applications. New York:Academic Press.

    See Also

    See Herfindahl, Rosenbluth for concentration measures and ineq() in the package ineq foradditional inequality measures

  • 42 AUC

    Examples

    # generate vector (of incomes)x

  • AxisBreak 43

    Examples

    AUC(x=c(1,3), y=c(1,1))

    AUC(x=c(1,2,3), y=c(1,2,4), method="trapezoid")AUC(x=c(1,2,3), y=c(1,2,4), method="step")

    plot(x=c(1,2,2.5), y=c(1,2,4), type="l", col="blue", ylim=c(0,4))lines(x=c(1,2,2.5), y=c(1,2,4), type="s", col="red")

    x

  • 44 axTicks.POSIXct

    Author(s)

    Jim Lemon and Ben Bolker

    Examples

    plot(3:10, main="Axis break test")

    # put a break at the default axis and positionAxisBreak()AxisBreak(2, 2.9, style="zigzag")

    axTicks.POSIXct Compute Axis Tickmark Locations (For POSIXct Axis)

    Description

    Compute pretty tickmark locations, the same way as R does internally. By default, gives the atvalues which axis.POSIXct(side, x) would use.

    Usage

    axTicks.POSIXct(side, x, at, format, labels = TRUE, ...)

    axTicks.Date(side = 1, x, ...)

    Arguments

    side See axis.

    x, at A date-time or date object.

    format See strptime.

    labels Either a logical value specifying whether annotations are to be made at the tick-marks, or a vector of character strings to be placed at the tickpoints.

    ... Further arguments to be passed from or to other methods.

    Details

    axTicks has no implementation for POSIXct axis. This function fills the gap.

    Value

    numeric vector of coordinate values at which axis tickmarks can be drawn.

    Author(s)

    Andri Signorell simply copying R-Core code

  • BarnardTest 45

    See Also

    axTicks, axis.POSIXct

    Examples

    with(beaver1, {time

  • 46 BarnardTest

    Details

    If x is a matrix, it is taken as a two-dimensional contingency table, and hence its entries should benonnegative integers. Otherwise, both x and y must be vectors of the same length. Incomplete casesare removed, the vectors are coerced into factor objects, and the contingency table is computed fromthese.

    For a 2x2 contingency table, such as X = [n1, n2;n3, n4], the normalized difference in proportionsbetween the two categories, given in each column, can be written with pooled variance (Scorestatistic) as

    T (X) =p2 p1

    p(1 p)( 1c1 +1c2

    ),

    where p = (n1+n3)/(n1+n2+n3+n4), p2 = n2/(n2+n4), p1 = n1/(n1+n3), c1 = n1+n3 andc2 = n2 + n4. Alternatively, with unpooled variance (Wald statistic), the difference in proportionscan we written as

    T (X) =p2 p1

    p1(1p1)c1

    + p2(1p2)c2

    .

    The probability of observing X is

    P (X) =c1!c2!

    n1!n2!n3!n4!pn1+n2(1 p)n3+n4 ,

    where p is the unknown nuisance parameter.

    Barnards test considers all tables with category sizes c1 and c2 for a given p. The p-value is thesum of probabilities of the tables having a score in the rejection region, e.g. having significantlylarge difference in proportions for a two-sided test. The p-value of the test is the maximum p-valuecalculated over all p between 0 and 1.

    Value

    A list with class "htest" containing the following components:

    p.value the p-value of the test.estimate an estimate of the nuisance parameter where the p-value is maximized.alternative a character string desc