411 REFERENCE · Wikibooks
Data Science: An Introduction/250 R Commands
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
150px|right
Data Science: An Introduction
Appendix 2: 250 R Commands
150px|link=Wikibooks:Creative Commons Attribution-ShareAlike 3.0 Unported License
Chapter Summary
This is copied verbatim from Jeromy Anglim's Bloghttp://jeromyanglim.blogspot.com/2010/05/abbreviations-of-r-commands-explained.html Abbreviations of R Commands Explained: 250+ R Abbreviations Jeromy Anglim May 10, 2010 Jeromy Anglim's Blog: Psychology and Statistics 8 August 2012
Discussion
Dr. Anglim writes:
The R programming language includes many abbreviations. Abbreviations exist in function names, argument names, and allowed values for arguments. This post expands on over 150 R abbreviations with the aim of making it easier for users new to R who are trying to memorise R commands.
Abbreviations save time when typing and can make for less cumbersome code. However, abbreviations often make it more difficult to remember a command. This is especially true when the user does not know what the abbreviation stands for.
R has been developed by a group of technical experts with backgrounds in Linux and Unix, mathematics, statistics, and statistical computing. With gaining popularity, R is now being used by people with little to none of this background. Abbreviations which are intuitive to the experts are not necessarily intuitive to this broader audience.
The R help system does a reasonable job of explaining the abbreviations in R. However, I thought it would be useful to write a post listing some of the common abbreviations along with the expansion of the abbreviation. Whereas R sometimes errs on the side of assuming expertise, I thought I'd err on the side of assuming naivety. Thus, the table includes many abbreviations which are probably obvious to most readers.
I thank Tom Short for his R reference Cardhttp://cran.r-project.org/doc/contrib/Short-refcard.pdf R Reference Card Tom Short 11 July 2004 The Comprehensive R Archive Network (CRAN) 8 August 2012 which provided some inspiration for a starting list of R commands. Feel free to reproduce or adapt this table elsewhere. For example, perhaps it could be included in an R Wiki with additional entries. If you spot an error in the table, let me know in the comments of this post.
I might expand the table in the future. At the moment, it's mainly function names with not many arguments or values of arguments. I also haven't put much time into grouping and ordering the functions.
Table of R Commands
+Table of R commandsR CommandAbbreviation ExpandedCommentsls[L]i[S]t objectsCommon command in Unix-like operating systemsrm[R]e[M]ove objectsCommon command in Unix-like operating systemsstr[STR]ucture of an objectPrint out the structure and example information of an R objectunz[UNZ]ipgetwd[GET] [W]orking [D]irectoryPrint out the current working directorydir[DIR]ectorysprintf[S]tring [PRINT] [F]ormattedc[C]ombine valuesregexpr[REG]ular [EXPR]essiondiag[DIAG]onal values of a matrixcol[COL]umnlapply[L]ist [APPLY]Apply function to each element and return a listsapply[S]implify [APPLY]Apply function to each element and attempt to return a vector (i.e., a vector is "simpler" than a list)mapply[M]ultivariate [APPLY]Multivariate version of sapply()tapply[T]able [APPLY]Apply function to sets of values as defined by an indexapply[APPLY] function to sets of values as defined by an indexMARGIN = 1 or 2 in applyrows [1] come before columns [2]For example, a 2 x 3 matrix has 2 rows and 3 columns (Note: row count is stated first)rmvnorm[R]andom number generator for [M]ulti[V]ariate [NORM]al datarle[R]un [L]ength [E]ncodingftable[F]ormat [TABLE]xtabsCross (i.e., [X]) [TAB]ulation[X] is the symbol of a cross; [X] is sometimes spoken as "by". Cross-tabulating means to cross one variable with anotherxtable[TABLE] of the object [X]formatC[FORMAT] using [C] style formatsi.e., [C] the programming languageSweave[S] [WEAVE]The R Programming language is a dialect of S. Weaving involves combining code and documentationcor[COR]relationancova[AN]alysis [O]f [COVA]riancemanova[M]ultivariate [AN]alysis [O]f [VA]rianceaov[A]nalysis [O]f [V]arianceTukeyHSD[T]ukey's [H]onestly [S]ignificant [D]ifferencehclust[H]ierarchical [CLUST]er analysiscmdscale[C]lassical metric [M]ulti[D]imensional [SCAL]ingfactanal[FACT]or [ANAL]ysisprincomp[PRIN]cipal [COMP]onents analysisprcomp[PR]incipal [COMP]onents analysislme[L]inear [M]ixed [E]ffects modelresid[RESID]ualsranef[RAN]dom [EF]fectsanova[AN]alysis [O]f [VA]riancefixef[FIX]ed [EF]ffectsvcov[V]ariance-[COV]ariance matrixlogLik[LOG] [LIK]elihoodBIC[B]ayesian [I]nformation [C]riteriamcmcsamp[M]arkov [Chain] [Monte] [C]arlo [SAMP]lingeval[EVAL]uate an R expressioncatcon[CAT]enateStandard Unix commandaproposSearch documentation for a purpose or on a topic (i.e., [APROPOS])Unix command for search documentation;read.csv[READ] a file in [C]omma [S]eperated [V]alues formati.e., in each row of the data commas separate values for each variableread.fwf[READ] a file in [F]ixed [W]idth [F]ormatseqGenerate [SEQ]uencerep[REP]licate values of xPerhaps also [REP]eatdim[DIM]ension of an objectTypically, number of rows and columns in a matrixgl[G]enerate factor [L]evelsrbind[R]ows [BIND]cbind[C]olumns [BIND]is.na[IS] [N]ot [A]vailablenrow[N]umber of [ROW]sncol[N]umber of [COL]umnsattr[ATTR]ibuterev[REV]ersediff[DIFF]erence between x and a lag of xprod[PROD]uctvar[VAR]iancesd[S]tandard [D]eviationcumsum[CUM]ulative [SUM]cumprod[CUM]ulative [PROD]uctsetdiff[SET] [DIFF]erenceintersect[INTERSECT]ionRe[RE]al part of a numberIm[IM]aginary part of a numberMod[MOD]ulo operationRemainder of division of one number by anothert[T]ranspose of a vector or matrixsubstr[SUBSTR]ingstrsplit[STR]ing [SPLIT]grep[G]lobal / [R]egular [E]xpression / [P]rintEtymology based on text editor instructions in programs such as edsub[SUB]stitute identified pattern found in stringgsub[G]lobal [SUB]stitute identified pattern found in stringpmatch[P]artial string [MATCH]ingnchar[N]umber of [CHAR]acters in a stringps.options[P]ost-[S]cript [OPTIONS]win.metafile[WIN]dows [METAFILE] graphicdev.off[DEV]ice [OFF]dev.cur[CUR]rent [DEV]icedev.set[SET] the current [DEV]icehist[HIST]ogrampie[PIE] Chartcoplot[CO]nditioning [PLOT]matplot[PLOT] columns of [MAT]ricesassocplot[ASSOC]iation [PLOT]plot.ts[PLOT] [T]ime [S]eriesqqnorm[Q]uantile-[Q]uantile [P]lot based on normal distributionpersp[PERSP]ective [P]lotxlim[LIM]it of the [X] axisylim[LIM]it of the [Y] axisxlab[LAB]el for the [X] axisylab[LAB]el for the [Y] axismain[MAIN] title for the plotsub[SUB] title for the plotmtext[M]argin [TEXT]abline[LINE] on plot often of the form y = [A] + [B] xh argument in abline[H]orizontal linev argument in abline[V]ertical lineparGraphics [PAR]ameteradj as par[ADJ]ust text [J]ustificationbg as par[B]ack[G]round colourbty as par[B]ox [TY]pecex as par[C]haracter [EX]tension or [EX]pansion of plotting objectscex.sub as par[C]haracter [EX]tension or [EX]pansion of [SUB]titlecex.axis as par[C]haracter [EX]tension or [EX]pansion of [AXIS] annotationcex.lab as par[C]haracter [EX]tension or [EX]pansion X and Y [LAB]elscex.main as par[C]haracter [EX]tension or [EX]pansion of [MAIN] titlecol as parDefault plotting [COL]ourlas as par[L]abel of [A]xis [S]tylelty as par[L]ine [TY]pelwd as par[L]ine [W]i[D]thmar as par[MAR]gin width in linesmfg as parNext [G]raph for [M]atrix of [F]iguresmfcol as par[M]atrix of [F]igures entered [COL]umn-wisemfrow as par[M]atrix of [F]igures entered [ROW]-wisepch as par[P]lotting [CH]aracterps as par[P]oint [S]ize of textPoint is a printing measurementpty as par[P]lot region [TY]petck as par[T]i[CK] mark lengthtcl as par[T]i[C]k mark [L]engthxaxs as par[X] [AX]is [S]tyleyaxs as par[Y] [AX]is [S]tylexaxt as par[X] [AX]is [T]ypeyaxt as par[Y] [AX]is [T]ypeasp as par[ASP]etc. ratioxlog as par[X] axis as [LOG]arithm scaleylog as par[Y] axis as [LOG]arithm scaleomi as par[O]uter [M]argin width in [I]nchesmai as par[MA]rgin width in [I]nchespin as par[P]lot size in [IN]chesxpd as parPerhaps: [X = Cut] [P]lot ? Perhaps D for devicexyplot[X] [Y] [PLOT][X] for horizontal axis; [Y] for vertical axisbwplot[B]ox and [W]hisker plotqq[Q]uantile-[Quantile] plot'splom[S]catter[PLO]t [M]atrixoptim[OPTIM]isationlm[L]inear [M]odelglm[G]eneralised [L]inear [M]odelnls[N]onlinear [L]east [S]quare parameter estimationloess[LO]cally [E]stimated [S]catterplot [S]moothingprop.test[TEST] null hypothesis that [PROP]ortions in several groups are the samernorm[R]andom number drawn from [NORM]al distributiondnorm[D]ensity of a given quantile in a [NORM]al distributionpnorm[D]istribution function for [NORM]al distribution returning cumulative [P]robabilityqnorm[Q]uantile function based on [NORM]al distributionrexp[R]andom number generation from [EXP]onential distributionrgamma[R]andom number generation from [GAMMA] distributionrpois[R]andom number generation from [POIS]on distributionrweibull[R]andom number generation from [WEIBULL] distributionrcauchy[R]andom number generation from [CAUCHY] distributionrbeta[R]andom number generation from [BETA] distributionrt[R]andom number generation from [t] distributionrf[R]andom number generation from [F] distributionF for Ronald [F]isherrchisq[R]andom number generation from [CHI] [SQ]uare distributionrbinom[R]andom number generation from [BINOM]ial distributionrgeom[R]andom number generation from [EXP]onential distributionrhyper[R]andom number generation from [HYPER]geometric distributionrlogis[R]andom number generation from [LOGIS]tic distributionrlnorm[R]andom number generation from [L]og [NOR]mal distributionrnbinom[R]andom number generation from [N]egative [BINOM]ial distributionrunif[R]andom number generation from [UNIF]orm distributionrwilcox[R]andom number generation from [WILCOX]on distributionggplot in ggplot2[G]rammar of [G]raphics [PLOT]See Leland Wilkinson (1999)aes in ggplot2[AES]thetic mappinggeom_ in ggplot2[GEOM]etric objectstat_ in ggplot2[STAT]istical summarycoord_ in ggplot2[COORD]inate systemqplot in ggplot2[Q]uick [PLOT]x as argument[X] is common letter for unknown variable in mathFUN as argument[FUN]ctionpos as argument[POS]itionlib.loc in library[LIB]rary folder [LOC]ationsep as argument[SEP]erator charactercomment.char in read.table[COMMENT] [CHAR]acter(s)I[I]nhibit [I]nterpretation or [I]nsulateT value[T]rueF value[F]alsena.rm as argument[N]ot [A]vailable [R]e[M]ovedfivenum[FIVE] [NUM]ber summaryIQR[I]nter [Q]uartile [R]angecoefModel [COEF]ficientsdist[DIST]ance matrixdf as argument[D]egrees of [F]reedommad[M]edian [A]bsolute [D]eviationsinkDivert R output to a connection (i.e., like connecting a pipe to a [SINK])eol in write.table[End] [O]f [L]ine character(s)R as software[R]oss Ihaka and [R]obert Gentleman or [R] is letter before SCRAN as word[C]omprehensive [R] [A]rchive [N]etworkAs I understand it: Inspired by CTAN (Comprehensive TeX Archive Network); pronunciation of CRAN rhymes with CTAN (i.e., "See" ran as in Iran; "See tan")Sexpr[S] [EXPR]essionls.strShow [STR]ucture of [L]i[S]ted objectsbrowseEnv[BROWSE] [ENV]ironmentenvir as argument[ENVIR]onmentq[Q]uitcancor[CAN]onical [COR]relationave[AVE]ragemin[MIN]imummax[MAX]imumsqrt[SQ]uare [R]oo[T]%o%[O]uter product&& is ampersand meaning [AND]|| often used to represent OR in computing (http://en.wikipedia.org /wiki /Logical_disjunction):Sequence generator; also used in MATLABnlevels[N]umber of [LEVELS] in a factordet[DET]erminant of a matrixcrossprodMatrix [CROSSPROD]uctgls[G]eneralised [L]east [S]quaresdwtest in lmtest[D]urbin-[W]atson Testsem in sem[S]tructural [E]quation [M]odelbetareg in betareg[BETA] [REG]ressionlogNatural [LOG]arithmDefault base is e consistent with most mathematics (http://en.wikipedia.org /wiki /Logarithm#Implicit_bases)log10[LOG]arithm base 10fft[F]ast [F]ourier [T]ransformexp[EXP]onential functionIn other words, e^xdf.residual[D]egrees of [F]reedom of the [R]esidualsin[SIN]e functioncos[COS]ine functiontan[TAN]gent functionasin[A]rc[SIN]e functionacos[A]rc[COS]ine functionatan[A]rc[TAN]gent functionderiv[DERIV]ativechol[Choleski] decompositionchol2inv[CHOL]eski [2=TO] [INV]ersesvd[S]ingular [V]alue [D]ecompositioneigen[EIGEN]value or [EIGEN]vectorlower.tri[LOWER] [TRI]angle of a matrixupper.tri[UPPER] [TRI]angle of a matrixacf[A]uto [C]orrelation or [C]ovariance [F]unctionpacf[P]artial A]uto [C]orrelation or [C]ovariance [F]unctionccf[C]ross [C]orrelation or [C]ovariance [F]unctionRattle as software[R] [A]nalytical [T]ool [T]o [L]earn [E]asilyPerhaps, easy like a baby's rattleStatET as softwareAnyone know? Statistics Eclipse?JGR as software[J]ava [G]UI for [R]Pronounced "Jaguar" like the catESS as software[E]macs [S]peaks [S]tatisticsRcmdr package[R] [C]o[m]man[d]e[r] GUIprettyNum[PRETTY] [NUM]berInf value[Inf]initeNaN value[N]ot [A] [N]umberis.nan[IS] [N]ot [A] [N]umberS3R is a dialect of [S]; 3 is the version numberS4R is a dialect of [S]; 4 is the version numberRterm as program[R] [TERM]inalR CMD as programI think: [R] [C]o[m]man[D] promptrepos as option[REPOS]itory locationsbin folder[BIN]ariesCommon Unix folder for "essential command binaries"etc folder[et cetera]Common Unix folder for "host-specific system-wide configuration filessrc folder[S]ou[RC]e [C]odeCommon Unix folderdoc folder[DOC]umentationRGUI program[R] [G]rapical [U]ser [I]nterface.site file extension[SITE] specific fileFor example, RProfile.siteHmisc packageFrank [HARRELL]'s package of [MISC]elaneous functionsn in debug[N]ext stepc in debug[C]ontinueQ in debug[Q]uitMASS package[M]odern [A]pplied [S]tatistics with [S]Based on book of same name by Venables and Ripleyplyr packagePL[Y=ie][R]Double play on words: (1) package manipulates data like pliers manipulate materials; (2) last letter is R as in the programaaplyinput [A]rray output [A]rray using [PLY]r packagedaplyinput [D]ata frame output [A]rray using [PLY]r packagelaplyinput [L]ist output [A]rray using [PLY]r packageadplyinput [A]rray output [D]ata frame using [PLY]r packagealplyinput [A]rray output [L]ist using [PLY]r packagea_plyinput [A]rray output Discarded (i.e., _ is blank) using [PLY]r packageRODBC package[R] [O]bject [D]ata[B]ase [C]onnectivitypsych package[PSYCH]ology related functionszelig package"Zelig is named after a Woody Allen movie about a man who had the strange ability to become the physical and psychological reflection of anyone he met and thus to fit perfectly in any situation." - http://gking. harvard.edu/ zelig/strucchange package[STRUC]tural [CHANGE]relaimpo package[RELA]tive [IMPO]rtancecar package[C]ompanion to [A]pplied [R]egressionNamed after book by John FoxOpenMx package[OPEN] Source [M]atri[X] algebra interpreterNeed confirmation that [Mx] means matrixdf in write.foreign[D]ata [F]rameGNU S word[GNU] is [N]ot [U]nix [S]R FAQ wordR [F]requently [A]sked [Q]uestionsDVI format[D]e[V]ice [I]ndependent file formatdevel word[DEVEL]opmentAs in code under developmentGPL word[G]eneral [P]ublic [L]icenseutils package[UTIL]itie[S]mle[M]aximum [L]ikelihood [E]stimationrpart package[R]ecursive [PART]itioningsna package[S]ocial [N]etwork [A]nalysisergm package[E]xponential [R]andom [G]raph [M]odelsrbugs package[R] interface to program [B]ayesian inference [Using] [G]ibbs [S]ampling
More Reading
http://cran.r-project.org/doc/manuals/R-intro.html An Introduction to R Anonymous, Bill Venables, and David M. Smith 22 June 2012 The Comprehensive R Archive Network (CRAN) 8 August 2012
References
Copyright Notice
100px|border|link=Wikibooks:Creative Commons Attribution-ShareAlike 3.0 Unported License
You are free:
to Share — to copy, distribute, display, and perform the work (pages from this wiki)
to Remix — to adapt or make derivative works
Under the following conditions:
Attribution — You must attribute this work to Wikibooks. You may not suggest that Wikibooks, in any way, endorses you or your use of this work.
Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.
Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.
Other Rights — In no way are any of the following rights affected by the license:
Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
The author's moral rights;
Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.
Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to the following web page.
http://creativecommons.org/licenses/by-nc-sa/3.0/