PrefaceIntroduction and preliminariesThe R environmentRelated software and documentationR and statisticsR and the window systemUsing R interactivelyAn introductory sessionGetting help with functions and featuresR commands, case sensitivity, etc.Recall and correction of previous commandsExecuting commands from or diverting output to a fileData permanency and removing objectsSimple manipulations; numbers and vectorsVectors and assignmentVector arithmeticGenerating regular sequencesLogical vectorsMissing valuesCharacter vectorsIndex vectors; selecting and modifying subsets of a data setOther types of objectsObjects, their modes and attributesIntrinsic attributes: mode and lengthChanging the length of an objectGetting and setting attributesThe class of an objectOrdered and unordered factorsA specific exampleThe function tapply() and ragged arraysOrdered factorsArrays and matricesArraysArray indexing. Subsections of an arrayIndex matricesThe array() functionMixed vector and array arithmetic. The recycling ruleThe outer product of two arraysGeneralized transpose of an arrayMatrix facilitiesMatrix multiplicationLinear equations and inversionEigenvalues and eigenvectorsSingular value decomposition and determinantsLeast squares fitting and the QR decompositionForming partitioned matrices, cbind() and rbind()The concatenation function, c(), with arraysFrequency tables from factorsLists and data framesListsConstructing and modifying listsConcatenating listsData framesMaking data framesattach() and detach()Working with data framesAttaching arbitrary listsManaging the search pathReading data from filesThe read.table() functionThe scan() functionAccessing builtin datasetsLoading data from other R packagesEditing dataProbability distributionsR as a set of statistical tablesExamining the distribution of a set of dataOne- and two-sample testsGrouping, loops and conditional executionGrouped expressionsControl statementsConditional execution: if statementsRepetitive execution: for loops, repeat and whileWriting your own functionsSimple examplesDefining new binary operatorsNamed arguments and defaultsThe ...{} argumentAssignments within functionsMore advanced examplesEfficiency factors in block designsDropping all names in a printed arrayRecursive numerical integrationScopeCustomizing the environmentClasses, generic functions and object orientationStatistical models in RDefining statistical models; formulaeContrastsLinear modelsGeneric functions for extracting model informationAnalysis of variance and model comparisonANOVA tablesUpdating fitted modelsGeneralized linear modelsFamiliesThe glm() functionNonlinear least squares and maximum likelihood modelsLeast squaresMaximum likelihoodSome non-standard modelsGraphical proceduresHigh-level plotting commandsThe plot() functionDisplaying multivariate dataDisplay graphicsArguments to high-level plotting functionsLow-level plotting commandsMathematical annotationHershey vector fontsInteracting with graphicsUsing graphics parametersPermanent changes: The par() functionTemporary changes: Arguments to graphics functionsGraphics parameters listGraphical elementsAxes and tick marksFigure marginsMultiple figure environmentDevice driversPostScript diagrams for typeset documentsMultiple graphics devicesDynamic graphicsPackagesStandard packagesContributed packages and CRANNamespacesA sample sessionInvoking RInvoking R from the command lineInvoking R under WindowsInvoking R under Mac OS XScripting with RThe command-line editorPreliminariesEditing actionsCommand-line editor summaryFunction and variable indexConcept indexReferencesAn Introduction to RNotes on R: A Programming Environment for Data Analysis and GraphicsVersion 2.9.1 (2009-06-26)W. N. Venables, D. M. Smithand the R Development Core TeamCopyrightc 1990 W. N. VenablesCopyrightc 1992 W. N. Venables & D. M. SmithCopyrightc 1997 R. Gentleman & R. IhakaCopyrightc 1997, 1998 M. MaechlerCopyrightc 1999–2009 R Development Core TeamPermission is granted to make and distribute verbatim copies of this manual provided the copy-right notice and this permission notice are preserved on all copies.Permission is granted to copy and distribute modified versions of this manual under the condi-tions for verbatim copying, provided that the entire resulting derived work is distributed underthe terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language,under the above conditions for modified versions, except that this permission notice may bestated in a translation approved by the R Development Core Team.ISBN 3-900051-12-7iTable of ContentsPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Introduction and preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.1 The R environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Related software and documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 R and statistics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 R and the window system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Using R interactively . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6 An introductory session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.7 Getting help with functions and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.8 R commands, case sensitivity, etc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.9 Recall and correction of previous commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.10 Executing commands from or diverting output to a file. . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.11 Data permanency and removing objects. . . . . . . . …
View Full Document