Appendix: R Reference - R in a Nutshell

by Joseph Adler
R in a Nutshell book cover

This excerpt is from R in a Nutshell. R is rapidly becoming the standard for developing statistical software, and R in a Nutshell provides a quick and practical way to learn this increasingly popular open source language and environment. You'll not only learn how to program in R, but also how to find the right user-contributed R packages for statistical modeling, visualization, and bioinformatics.

buy button

Click on any of the function names or data set names below to jump to its description. To filter the function and data set names, enter text into the Filter box below.




! != $, $<- %% %*% %/% %in% %o% %x% & && * + - / : :: ::: < > >= <= == @ Arg Conj Cstack_info Encoding, Encoding<- Filter Find I ISOdate, ISOdatetime Im La.svd Map Mod NCOL, NROW Negate NextMethod Position R.Version R.home RNGkind RNGversion R_system_version Re Recall Reduce Sys.Date, Sys.time Sys.chmod Sys.getenv Sys.getlocale Sys.getpid Sys.glob Sys.localeconv Sys.setenv Sys.setlocale Sys.sleep Sys.timezone Sys.umask Sys.unsetenv Sys.which UseMethod Vectorize ^ abbreviate abs acos acosh addNA addTaskCallback agrep alist all all.equal all.names, all.vars any anyDuplicated aperm append apply args array as.Date as.POSIXct, as.POSIXlt as.array as.character as.complex as.difftime as.double as.environment as.expression as.factor as.function as.hexmode as.integer as.list as.logical as.matrix as.null as.numeric as.numeric_version as.octmode as.ordered as.package_version as.pairlist as.raw as.real as.symbol as.table as.vector asS4 asin asinh assign atan atan2 atanh attach attachNamespace attr, attr<- attributes, attributes<- autoload, autoloader backsolve baseenv basename besselI, besselJ, besselK, besselY beta bindingIsActive, bindingIsLocked bindtextdomain body, body<- bquote break browser builtins by bzfile c call callCC capabilities casefold cat cbind ceiling char.expand charToRaw character charmatch chartr check_tzones chol chol2inv choose class, class<- close, close.connection closeAllConnections col colMeans colSums colnames, colnames<- commandArgs comment, comment<- computeRestarts conditionCall, conditionCall.condition, conditionMessage, conditionMessage.condition conflicts contributors crossprod cummax, cummin, cumprod, cumsum cut cut.Date, cut.POSIXt dQuote data.class data.frame data.matrix date debug default.stringsAsFactors delayedAssign deparse det, determinant detach dget diag, diag<- diff, diff.Date, diff.POSIXt, diff.default difftime digamma dim,, dim<-, dimnames,, dimnames<-, dimnames< dir, dir.create dirname double dput drop dump duplicated dyn.load, dyn.unload eapply eigen emptyenv encodeString env.profile environment, environment<- environmentIsLocked environmentName eval, eval.parent, evalq exists exp expand.grid expm1 expression factor factorial fifo file file.access file.append file.choose file.copy, file.create, file.exists file.path file.remove, file.rename file.symlink findInterval findRestart floor flush, flush.connection force formals, formals<- format, format.AsIs formatC formatDL forwardsolve function gamma gc gc.time gcinfo gctorture get getAllConnections getCConverterDescriptions, getCConverterStatus getConnection getDLLRegisteredRoutines, getDLLRegisteredRoutines.DLLInfo, getDLLRegisteredRoutines.character getExportedValue getHook getLoadedDLLs getNamespace, getNamespaceExports, getNamespaceImports, getNamespaceName, getNamespaceUsers, getNamespaceVersion getNativeSymbolInfo getNumCConverters getOption getRversion getSrcLines getTaskCallbackNames geterrmessage gettext gettextf getwd gl globalenv gregexpr, grep, grepl, gsub gsub gzcon gzfile iconv, iconvlist icuSetCollate identical identity ifelse inherits intToBits intToUtf8 integer interaction interactive intersect inverse.rle invisible invokeRestart, invokeRestartInteractively is.R is.array is.atomic is.character is.complex is.double is.element is.environment is.expression is.factor is.finite, is.infinite is.function is.integer is.language is.list is.loaded is.logical is.matrix,<- is.nan is.null is.numeric, is.numeric.Date, is.numeric.POSIXt is.numeric_version is.ordered is.package_version is.pairlist is.primitive is.qr is.raw is.recursive is.symbol is.table is.unsorted is.vector isIncomplete, isOpen isRestart isS4 isSeekable isSymmetric, isSymmetric.matrix isTRUE isdebugged jitter julian, julian.Date, julian.POSIXt kappa, kappa.defaultm, kappa.lm, kappa.qr, kappa.tri kronecker l10n_info labels lapply lazyLoad lbeta, lchoose length, length<-, length<-.factor levels, levels.default, levels<-, levels<-.factor lfactorial, lgamma library library.dynam library.dynam.unload licence list list.files load loadNamespace loadedNamespaces loadingNamespaceInfo local lockBinding lockEnvironment log log10 log1p log2 logical lower.tri ls make.names make.unique makeActiveBinding mapply margin.table mat.or.vec match match.arg matrix max max.col mean memory.profile merge,, merge.default message mget min missing mode, mode<- months mostattributes<- names, names<- nargs nchar ncol, nrow new.env ngettext nlevels noquote numeric numeric_version nzchar objects oldClass, oldClass<- on.exit open, open.connection open.srcfile, open.srcfilecopy options order ordered outer packBits packageEvent packageStartupMessage package_version pairlist parent.env, parent.env<- parent.frame parse parseNamespaceFile paste path.expand pipe pmatch pmax,, pmin, polyroot pretty prettyNum print prmatrix proc.time prod prop.table psigamma pushBack, pushBackLength q qr qr.coef qr.qy qr.qty qr.resid qr.solve qr.fitted qr.Q, qr.R, qr.X quarters quit quote range rank rapply raw rawConnection, rawConnectionValue rawShift, rawToBits, rawToChar rbind rcond read.dcf readBin readChar readLines readline real reg.finalizer regexpr remove, rm removeCConverter removeTaskCallback rep, replace replicate require retracemem return rev rle round round.POSIXt row row.names, row.names<- rowMeans, rowSums rownames, rownames<- rowsum sQuote sample sapply save save.image saveNamespaceImage scale scan search searchpaths seek, seek.connection seq,, seq_along, seq_len sequence serialize set.seed setCConverterStatus setHook setSessionTimeLimit, setTimeLimit setdiff, setequal setwd shQuote showConnections sign signalCondition signif simpleCondition, simpleError, simpleMessage, simpleWarning sin sinh sink, sink.number slice.index socketConnection socketSelect solve solve.qr sort source split, split<- sprintf sqrt srcfile srcfilecopy srcref standardGeneric stderr stdin stdout stop stopifnot storage.mode, storage.mode<- strftime, strptime strsplit strtrim structure strwrap sub subset substitute substr, substr<-, substring, substring<- sum summary suppressMessages, suppressPackageStartupMessages suppressWarnings svd sweep switch, sys.calls, sys.frame, sys.frames, sys.function, sys.nframe, sys.on.exit, sys.parent, sys.parents sys.source sys.status system system.file system.time t table tabulate tan tanh tapply taskCallbackManager tcrossprod tempdir, tempfile textConnection, textConnectionValue toString tolower topenv toupper trace traceback tracemem tracingState transform trigamma trunc truncate, truncate.connection try tryCatch typeof unclass undebug union unique units, units<- unix.time unlink unlist unloadNamespace unlockBinding unname unserialize unsplit untrace untracemem unz upper.tri url utf8ToInt vector warning warnings weekdays which which.max, which.min with withCallingHandlers withRestarts withVisible within write write.dcf writeBin writeChar writeLines xor xtfrm zapsmall ~



Rows as.shingle, as.factorOrShingle axis.default banking barchart bwplot canonical.theme cloud col.whitebg contourplot current.column current.panel.limits current.row densityplot diag.panel.splom do.breaks dotplot draw.colorkey draw.key equal.count histogram is.shingle larrows, llines, lplot.xy, lpoints, lpolygon, lrect, lsegments, ltext, panel.points, panel.polygon, panel.rect, panel.segments, panel.text lattice.getOption, lattice.options latticeParseFormula level.colors levelplot ltransform3dMatrix, ltransform3dto3d make.groups oneway packet.number packet.panel.default panel.3dscatter, panel panel.abline panel.average panel.arrows panel.axis panel.barchart panel.brush.splom panel.bwplot panel.contourplot panel.curve panel.densityplot panel.dotplot panel.error panel.fill panel.grid panel.histogram panel.identify panel.levelplot panel.linejoin panel.lines panel.lmline panel.loess panel.mathdensity panel.number panel.pairs panel.parallel panel.qq panel.qqmath panel.qqmathline panel.refline panel.rug panel.smoothScatter panel.splom panel.stripplot panel.superpose, panel.superpose.2 panel.tmd.default, panel.tmd.qqmath panel.violin panel.wireframe panel.xyplot parallel bwplot,, prepanel.default.densityplot, prepanel.default.histogram, prepanel.default.levelplot, prepanel.default.parallel, prepanel.default.qq, prepanel.default.qqmath, prepanel.default.splom, prepanel.default.xyplot prepanel.lmline, prepanel.loess, prepanel.qqmathline prepanel.tmd.default, prepanel.tmd.qqmath qq qqmath rfs shingle show.settings simpleKey simpleTheme splom standard.theme strip.custom strip.default stripplot tmd trellis.currentLayout trellis.device trellis.focus, trellis.grobname trellis.last.object trellis.panelArgs trellis.par.get, trellis.par.set trellis.switchFocus trellis.unfocus trellis.vpname which.packet wireframe xscale.components.default, yscale.components.default xyplot



@<- MethodAddCoerce Quote S3Class, S3Class<- S3Part, S3Part<- addNextMethod allNames as, as<- asMethodDefinition assignClassDef assignMethodsMetaData balanceMethodsList body<- cacheGenericsMetaData, cacheMetaData cacheMethod callGeneric callNextMethod canCoerce cbind2 checkSlotAssignment classMetaName classesToAM coerce, coerce<- completeClassDefinition completeExtends completeSubclasses conformMethod defaultDumpName defaultPrototype doPrimitiveMethod dumpMethod dumpMethods elNamed, elNamed<- existsFunction existsMethod extends findClass findFunction findMethod findMethodSignatures findMethods findUnique fixPre1.8 formalArgs functionBody, functionBody<- generic.skeleton getAllSuperClasses getClass, getClassDef getClasses getDataPart getFromClassDef getFunction getGeneric getGenerics getGroup getGroupMembers getMethod getMethods getMethodsForDispatch getMethodsMetaData getPackageName getSlots getValidity hasArg hasMethod hasMethods implicitGeneric initialize is isClass isClassDef isClassUnion isGeneric isGroup isSealedClass, isSealedMethod isVirtualClass isXS3Class listFromMethods makeClassRepresentation makeExtends makeGeneric makePrototypeFromClassDef makeStandardGeneric matchSignature metaNameUndo method.skeleton methodSignatureMatrix methodsPackageMetaName missingArg new newBasic newClassRepresentation newEmptyObject packageName packageSlot, packageSlot<- possibleExtends prohibitGeneric promptClass promptMethods prototype rbind2 reconcilePropertiesAndPrototype registerImplicitGenerics rematchDefinition removeClass removeGeneric removeMethod removeMethods representation requireMethods resetClass resetGeneric sealClass selectMethod selectSuperClasses sessionData setAs setClass setClassUnion setDataPart setGeneric setGenericImplicit setGroupGeneric setIs setMethod setOldClass setPackageName setPrimitiveMethods setReplaceMethod setValidity show showClass showDefault showExtends showMethods sigToEnv signature slot, slot<- slotNames slotsFromS3 substituteDirect standardGeneric substituteFunctionArgs superClassDepth testInheritedMethods testVirtual traceOff traceOn tryNew, trySilent unRematchDefinition validObject validSlotNames



AIC ARMAacf ARMAtoMA Box.test C D Gamma HoltWinters IQR KalmanForecast, KalmanLike, KalmanRun, KalmanSmooth NLSstAsymptotic NLSstClosestX NLSstLfAsymptote NLSstRtAsymptote PP.test SSD SSasymp SSasympOff SSasympOrig SSbiexp SSfol SSfpl SSgompertz SSlogis SSmicmen SSweibull StructTS TukeyHSD TukeyHSD.aov acf acf2AR add.scope add1 addmargins aggregate alias anova anova.lmlist ansari.test aov approx approxfun ar arima arima.sim arima0 as.dendrogram as.dist as.formula as.hclust as.stepfun as.ts asOneSidedFormula ave bandwidth.kernel bartlett.test binom.test binomial biplot bw.SJ, bw.bcv, bw.nrd, bw.nrd0, bw.ucv cancor case.names ccf chisq.test clearNames cmdscale coef, coefficients complete.cases confint constrOptim contr.SAS, contr.helmert, contr.poly, contr.sum, contr.treatment contrasts, contrasts<- convolve cooks.distance cophenetic cor cor.test cov cov.wt cov2cor covratio cpgram cutree cycle dbeta dbinom dcauchy dchisq decompose delete.response deltat dendrapply density density.default deriv, deriv3 deviance dexp df df.kernel df.residual dfbeta dfbetas dffits dgamma dgeom dhyper diff.ts diffinv dist dlnorm dlogis dmultinom dnbinom dnorm dpois drop.scope drop.terms drop1 dsignrank dt dummy.coef dunif dweibull dwilcox ecdf eff.aovlist effects embed end estVar expand.model.frame extractAIC factanal family fft filter fisher.test fitted, fitted.values fivenum fligner.test formula frequency friedman.test ftable gaussian getInitial get_all_vars glm glm.control hasTsp hat, hatvalues, hatvalues.lm hclust heatmap influence influence.measures integrate interaction.plot inverse.gaussian is.empty.model is.leaf is.mts is.stepfun is.ts is.tskernel isoreg kernapply kernel kmeans knots kruskal.test ks.test ksmooth lag lag.plot line lines.ts lm lm.influence lm.wfit loadings loess loess.control loess.smooth logLik loglin lowess ls.diag ls.print lsfit mad mahalanobis makeARIMA makepredictcall manova mantelhaen.test mauchly.test mcnemar.test median median.default medpolish model.extract model.frame model.matrix model.offset model.response model.tables model.weights monthplot mood.test mvfft na.action na.contiguous na.exclude na.omit na.pass napredict naprint naresid nextn nlm nlminb nls nls.control numericDeriv offset oneway.test optim optimise, optimize order.dendrogram p.adjust pacf pairwise.prop.test pairwise.t.test pairwise.table pairwise.wilcox.test pbeta pbinom pbirthday pcauchy pchisq pexp pf pgamma pgeom phyper plclust plnorm plogis plot.TukeyHSD plot.density plot.ecdf plot.lm plot.mlm plot.spec, plot.spec.coherency, plot.spec.phase plot.stepfun plot.ts pnbinom pnorm poisson poisson.test poly, polym power power.anova.test power.prop.test power.t.test ppoints ppois ppr prcomp predict preplot princomp printCoefmat profile proj promax prop.test prop.trend.test psignrank pt ptukey punif pweibull pwilcox qbeta qbinom qbirthday qcauchy qchisq qexp qf qgamma qgeom qhyper qlnorm qlogis qnbinom qnorm qpois qqline qqnorm qqplot qsignrank qt qtukey quade.test quantile quantile.default quasi quasibinomial quasipoisson qunif qweibull qwilcox r2dtable rbeta rbinom rcauchy rchisq read.ftable rect.hclust reformulate relevel reorder replications reshape resid residuals rexp rf rgamma rgeom rhyper rlnorm rlogis rmultinom rnbinom rnorm rpois rsignrank rstandard rstudent rt runif runmed rweibull rwilcox scatter.smooth screeplot sd se.contrast selfStart setNames shapiro.test simulate smooth smooth.spline smoothEnds sortedXyData spec.pgram spec.taper spectrum spline splinefun splinefunH start stat.anova step stepfun stl supsmu symnum t.test termplot terms time toeplitz ts ts.intersect ts.plot ts.union tsSmooth tsdiag tsp, tsp<- uniroot update var var.test variable.names varimax vcov weighted.mean weighted.residuals weights wilcox.test window, window<- write.ftable xtabs



? RShowDoc RSiteSearch Rprof Rprofmem Rtangle RtangleSetup RtangleWritedoc RweaveChunkPrefix RweaveEvalWithOpt RweaveLatex RweaveLatexFinish RweaveLatexOptions RweaveLatexSetup RweaveLatexWritedoc RweaveTryStop Stangle Sweave SweaveSyntConv URLdecode URLencode View alarm apropos argsAnywhere as.person as.personList as.relistable as.roman assignInNamespace available.packages browseEnv browseURL browseVignettes capture.output checkCRAN chooseCRANmirror citEntry citFooter citHeader citation close.socket combn compareVersion contrib.url count.fields data data.entry, dataentry, de, de.ncols, de.restore, de.setup debugger demo download.file download.packages dump.frames edit emacs example file.edit file_test find fix fixInNamespace flush.console formatOL, formatUL getAnywhere getCRANmirrors getFromNamespace getS3method getTxtProgressBar glob2rx head help help.request help.start history install.packages installed.packages is.relistable limitedLabels loadhistory localeToCharset ls.str, lsf.str make.packages.html make.socket makeRweaveLatexCodeRunner memory.limit memory.size menu methods mirror2html modifyList new.packages normalizePath nsl object.size old.packages package.skeleton packageDescription packageStatus page person personList pico prompt promptData promptPackage read.DIF read.csv, read.csv2, read.delim, read.delim2 read.fortran read.fwf read.socket read.table readCitationFile recover relist remove.packages rtags savehistory select.list sessionInfo setRepositories setTxtProgressBar stack str strOptions summaryRprof tail timestamp toBibtex toLatex txtProgressBar type.convert unstack unzip update.packageStatus update.packages upgrade vi vignette write.csv, write.csv2 write.socket write.table wsbrowser xedit xemacs zip.file.extract

Pages: 1, 2, 3, 4, 5

Next Pagearrow