• Nenhum resultado encontrado

fullrefman

N/A
N/A
Protected

Academic year: 2021

Share "fullrefman"

Copied!
3424
0
0

Texto

(1)

R: A Language and Environment for

Statistical Computing

Reference Index

The R Core Team

Version 3.1.3 (2015-03-09)

Copyright (©) 1999–2012 R Foundation for Statistical Computing.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the 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 be stated in a translation approved by the R Core Team.

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the GNU General Public License. For more information about these matters, see http://www.gnu.org/copyleft/gpl.html.

(2)

Contents

I

1

1 The base package 3

base-package . . . 3 .bincode . . . 3 .Device . . . 4 .Machine . . . 5 .Platform . . . 7 abbreviate . . . 8 agrep . . . 10 all . . . 12 all.equal . . . 13 all.names . . . 15 any . . . 16 aperm . . . 17 append . . . 18 apply . . . 19 args . . . 20 Arithmetic . . . 21 array . . . 24 as.data.frame . . . 25 as.Date . . . 27 as.environment . . . 30 as.function . . . 31 as.POSIX* . . . 32 AsIs . . . 34 assign . . . 35 assignOps . . . 37 attach . . . 38 attr . . . 40 attributes . . . 41 autoload . . . 42 backsolve . . . 43 basename . . . 44 Bessel . . . 45 bindenv . . . 47 bitwise . . . 49 body . . . 50 bquote . . . 51 browser . . . 52 i

(3)

ii CONTENTS browserText . . . 54 builtins . . . 55 by . . . 55 c . . . 56 call . . . 58 callCC . . . 59 CallExternal . . . 60 capabilities . . . 61 cat . . . 63 cbind . . . 64 char.expand . . . 67 character . . . 67 charmatch . . . 69 chartr . . . 70 chol . . . 71 chol2inv . . . 73 class . . . 74 col . . . 76 Colon . . . 77 colSums . . . 78 commandArgs . . . 80 comment . . . 80 Comparison . . . 81 complex . . . 83 conditions . . . 85 conflicts . . . 88 connections . . . 89 Constants . . . 97 contributors . . . 98 Control . . . 98 copyright . . . 100 crossprod . . . 100 Cstack_info . . . 101 cumsum . . . 102 cut . . . 103 cut.POSIXt . . . 105 data.class . . . 106 data.frame . . . 107 data.matrix . . . 109 date . . . 110 Dates . . . 111 DateTimeClasses . . . 112 dcf . . . 115 debug . . . 118 Defunct . . . 119 delayedAssign . . . 119 deparse . . . 120 deparseOpts . . . 122 Deprecated . . . 123 det . . . 124 detach . . . 125 diag . . . 127

(4)

CONTENTS iii diff . . . 128 difftime . . . 129 dim . . . 131 dimnames . . . 132 do.call . . . 134 dontCheck . . . 135 double . . . 136 dput . . . 137 drop . . . 139 droplevels . . . 140 dump . . . 141 duplicated . . . 142 dyn.load . . . 145 eapply . . . 147 eigen . . . 148 encodeString . . . 150 Encoding . . . 151 environment . . . 152 EnvVar . . . 155 eval . . . 157 exists . . . 159 expand.grid . . . 161 expression . . . 162 Extract . . . 163 Extract.data.frame . . . 167 Extract.factor . . . 171 Extremes . . . 172 factor . . . 174 file.access . . . 177 file.choose . . . 178 file.info . . . 179 file.path . . . 180 file.show . . . 181 files . . . 182 files2 . . . 184 find.package . . . 186 findInterval . . . 187 force . . . 188 Foreign . . . 189 formals . . . 192 format . . . 193 format.info . . . 196 format.pval . . . 197 formatC . . . 198 formatDL . . . 201 function . . . 202 funprog . . . 203 gc . . . 205 gc.time . . . 207 gctorture . . . 208 get . . . 209 getDLLRegisteredRoutines . . . 210

(5)

iv CONTENTS getLoadedDLLs . . . 212 getNativeSymbolInfo . . . 213 gettext . . . 215 getwd . . . 216 gl . . . 217 grep . . . 218 grepRaw . . . 223 groupGeneric . . . 224 gzcon . . . 226 hexmode . . . 228 Hyperbolic . . . 229 iconv . . . 230 icuSetCollate . . . 232 identical . . . 235 identity . . . 237 ifelse . . . 237 integer . . . 238 interaction . . . 240 interactive . . . 241 Internal . . . 242 InternalMethods . . . 242 invisible . . . 243 is.finite . . . 244 is.function . . . 245 is.language . . . 246 is.object . . . 247 is.R . . . 247 is.recursive . . . 248 is.single . . . 249 is.unsorted . . . 250 ISOdatetime . . . 250 isS4 . . . 251 isSymmetric . . . 252 jitter . . . 253 kappa . . . 254 kronecker . . . 256 l10n_info . . . 257 labels . . . 258 lapply . . . 258 Last.value . . . 261 La_version . . . 262 length . . . 262 levels . . . 264 libPaths . . . 265 library . . . 267 library.dynam . . . 269 license . . . 271 list . . . 272 list.files . . . 274 list2env . . . 275 load . . . 276 locales . . . 278

(6)

CONTENTS v log . . . 280 Logic . . . 281 logical . . . 283 LongVectors . . . 284 lower.tri . . . 285 ls . . . 286 make.names . . . 287 make.unique . . . 288 mapply . . . 289 margin.table . . . 290 mat.or.vec . . . 291 match . . . 292 match.arg . . . 293 match.call . . . 294 match.fun . . . 296 MathFun . . . 297 matmult . . . 298 matrix . . . 299 maxCol . . . 301 mean . . . 302 memCompress . . . 303 Memory . . . 304 Memory-limits . . . 305 memory.profile . . . 307 merge . . . 307 message . . . 309 missing . . . 311 mode . . . 312 NA . . . 313 name . . . 315 names . . . 316 nargs . . . 318 nchar . . . 319 nlevels . . . 320 noquote . . . 321 norm . . . 322 normalizePath . . . 323 NotYet . . . 325 nrow . . . 325 ns-dblcolon . . . 326 ns-hooks . . . 327 ns-load . . . 328 ns-topenv . . . 330 NULL . . . 331 numeric . . . 332 NumericConstants . . . 333 numeric_version . . . 334 octmode . . . 336 on.exit . . . 337 Ops.Date . . . 338 options . . . 339 order . . . 346

(7)

vi CONTENTS outer . . . 349 Paren . . . 350 parse . . . 351 paste . . . 353 path.expand . . . 354 pcre_config . . . 355 pmatch . . . 356 polyroot . . . 357 pos.to.env . . . 358 pretty . . . 359 Primitive . . . 360 print . . . 361 print.data.frame . . . 363 print.default . . . 364 prmatrix . . . 366 proc.time . . . 367 prod . . . 368 prop.table . . . 369 pushBack . . . 370 qr . . . 371 QR.Auxiliaries . . . 373 quit . . . 375 Quotes . . . 376 R.Version . . . 378 Random . . . 379 Random.user . . . 383 range . . . 385 rank . . . 386 rapply . . . 387 raw . . . 389 rawConnection . . . 390 rawConversion . . . 391 RdUtils . . . 392 readBin . . . 393 readChar . . . 396 readline . . . 398 readLines . . . 399 readRDS . . . 400 readRenviron . . . 402 Recall . . . 403 reg.finalizer . . . 404 regex . . . 405 regmatches . . . 409 remove . . . 410 rep . . . 411 replace . . . 414 Reserved . . . 414 rev . . . 415 Rhome . . . 415 rle . . . 416 Round . . . 417 round.POSIXt . . . 419

(8)

CONTENTS vii row . . . 420 row+colnames . . . 421 row.names . . . 422 rowsum . . . 423 sample . . . 424 save . . . 426 scale . . . 429 scan . . . 430 search . . . 434 seek . . . 435 seq . . . 436 seq.Date . . . 438 seq.POSIXt . . . 439 sequence . . . 441 serialize . . . 441 sets . . . 443 setTimeLimit . . . 444 showConnections . . . 445 shQuote . . . 446 sign . . . 447 Signals . . . 448 sink . . . 449 slice.index . . . 450 slotOp . . . 451 socketSelect . . . 452 solve . . . 453 sort . . . 454 source . . . 457 Special . . . 459 split . . . 462 sprintf . . . 464 sQuote . . . 467 srcfile . . . 469 Startup . . . 471 stop . . . 474 stopifnot . . . 476 strptime . . . 477 strsplit . . . 482 strtoi . . . 484 strtrim . . . 485 structure . . . 486 strwrap . . . 487 subset . . . 488 substitute . . . 490 substr . . . 491 sum . . . 493 summary . . . 494 svd . . . 495 sweep . . . 497 switch . . . 498 Syntax . . . 500 Sys.getenv . . . 501

(9)

viii CONTENTS Sys.getpid . . . 502 Sys.glob . . . 502 Sys.info . . . 504 Sys.localeconv . . . 505 sys.parent . . . 506 Sys.readlink . . . 508 Sys.setenv . . . 509 Sys.setFileTime . . . 510 Sys.sleep . . . 511 sys.source . . . 512 Sys.time . . . 513 Sys.which . . . 514 system . . . 515 system.file . . . 517 system.time . . . 518 system2 . . . 519 t . . . 520 table . . . 521 tabulate . . . 524 tapply . . . 525 taskCallback . . . 526 taskCallbackManager . . . 528 taskCallbackNames . . . 530 tempfile . . . 531 textConnection . . . 532 tilde . . . 534 timezones . . . 535 toString . . . 537 trace . . . 538 traceback . . . 542 tracemem . . . 543 transform . . . 545 Trig . . . 546 try . . . 547 typeof . . . 549 unique . . . 549 unlink . . . 551 unlist . . . 552 unname . . . 554 UseMethod . . . 554 userhooks . . . 557 utf8Conversion . . . 559 vector . . . 560 Vectorize . . . 562 warning . . . 563 warnings . . . 564 weekdays . . . 565 which . . . 567 which.min . . . 568 with . . . 569 withVisible . . . 571 write . . . 572

(10)

CONTENTS ix writeLines . . . 573 xtfrm . . . 574 zapsmall . . . 574 zpackages . . . 575 zutils . . . 576

2 The compiler package 577 compile . . . 577

3 The datasets package 581 datasets-package . . . 581 ability.cov . . . 581 airmiles . . . 582 AirPassengers . . . 583 airquality . . . 584 anscombe . . . 585 attenu . . . 586 attitude . . . 587 austres . . . 588 beavers . . . 588 BJsales . . . 589 BOD . . . 590 cars . . . 591 ChickWeight . . . 592 chickwts . . . 593 CO2 . . . 594 co2 . . . 595 crimtab . . . 596 discoveries . . . 598 DNase . . . 598 esoph . . . 599 euro . . . 601 eurodist . . . 602 EuStockMarkets . . . 602 faithful . . . 603 Formaldehyde . . . 604 freeny . . . 605 HairEyeColor . . . 606 Harman23.cor . . . 607 Harman74.cor . . . 607 Indometh . . . 608 infert . . . 609 InsectSprays . . . 610 iris . . . 610 islands . . . 612 JohnsonJohnson . . . 612 LakeHuron . . . 613 lh . . . 613 LifeCycleSavings . . . 614 Loblolly . . . 615 longley . . . 616 lynx . . . 617 morley . . . 617

(11)

x CONTENTS mtcars . . . 618 nhtemp . . . 619 Nile . . . 620 nottem . . . 621 npk . . . 622 occupationalStatus . . . 623 Orange . . . 623 OrchardSprays . . . 624 PlantGrowth . . . 625 precip . . . 626 presidents . . . 627 pressure . . . 627 Puromycin . . . 628 quakes . . . 629 randu . . . 630 rivers . . . 631 rock . . . 631 sleep . . . 632 stackloss . . . 633 state . . . 634 sunspot.month . . . 635 sunspot.year . . . 636 sunspots . . . 637 swiss . . . 638 Theoph . . . 639 Titanic . . . 640 ToothGrowth . . . 641 treering . . . 642 trees . . . 643 UCBAdmissions . . . 643 UKDriverDeaths . . . 645 UKgas . . . 646 UKLungDeaths . . . 646 USAccDeaths . . . 647 USArrests . . . 647 USJudgeRatings . . . 648 USPersonalExpenditure . . . 649 uspop . . . 649 VADeaths . . . 650 volcano . . . 651 warpbreaks . . . 651 women . . . 652 WorldPhones . . . 653 WWWusage . . . 654

4 The grDevices package 655 grDevices-package . . . 655 adjustcolor . . . 655 as.graphicsAnnot . . . 657 as.raster . . . 657 axisTicks . . . 659 boxplot.stats . . . 660 cairo . . . 662

(12)

CONTENTS xi check.options . . . 664 chull . . . 665 cm . . . 666 col2rgb . . . 666 colorRamp . . . 668 colors . . . 670 contourLines . . . 671 convertColor . . . 672 densCols . . . 674 dev . . . 675 dev.capabilities . . . 676 dev.capture . . . 678 dev.flush . . . 678 dev.interactive . . . 679 dev.size . . . 680 dev2 . . . 681 dev2bitmap . . . 683 devAskNewPage . . . 685 Devices . . . 685 embedFonts . . . 686 extendrange . . . 688 getGraphicsEvent . . . 688 gray . . . 691 gray.colors . . . 692 hcl . . . 693 Hershey . . . 695 hsv . . . 698 Japanese . . . 699 make.rgb . . . 700 n2mfrow . . . 701 nclass . . . 702 palette . . . 703 Palettes . . . 704 pdf . . . 706 pdf.options . . . 710 pictex . . . 711 plotmath . . . 713 png . . . 717 postscript . . . 721 postscriptFonts . . . 727 pretty.Date . . . 729 ps.options . . . 730 quartz . . . 732 quartzFonts . . . 734 recordGraphics . . . 735 recordPlot . . . 736 rgb . . . 737 rgb2hsv . . . 738 savePlot . . . 740 trans3d . . . 741 Type1Font . . . 742 x11 . . . 743

(13)

xii CONTENTS X11Fonts . . . 748 xfig . . . 749 xy.coords . . . 751 xyTable . . . 752 xyz.coords . . . 753

5 The graphics package 755 graphics-package . . . 755 abline . . . 755 arrows . . . 757 assocplot . . . 758 Axis . . . 760 axis . . . 761 axis.POSIXct . . . 763 axTicks . . . 765 barplot . . . 766 box . . . 770 boxplot . . . 771 boxplot.matrix . . . 774 bxp . . . 775 cdplot . . . 777 clip . . . 780 contour . . . 781 convertXY . . . 783 coplot . . . 784 curve . . . 787 dotchart . . . 789 filled.contour . . . 790 fourfoldplot . . . 793 frame . . . 794 grid . . . 795 hist . . . 796 hist.POSIXt . . . 799 identify . . . 800 image . . . 803 layout . . . 805 legend . . . 807 lines . . . 812 locator . . . 813 matplot . . . 814 mosaicplot . . . 817 mtext . . . 820 pairs . . . 821 panel.smooth . . . 824 par . . . 825 persp . . . 834 pie . . . 837 plot . . . 839 plot.data.frame . . . 840 plot.default . . . 841 plot.design . . . 843 plot.factor . . . 845 plot.formula . . . 846

(14)

CONTENTS xiii plot.histogram . . . 848 plot.table . . . 849 plot.window . . . 850 plot.xy . . . 851 points . . . 852 polygon . . . 856 polypath . . . 858 rasterImage . . . 860 rect . . . 861 rug . . . 862 screen . . . 863 segments . . . 865 smoothScatter . . . 866 spineplot . . . 868 stars . . . 870 stem . . . 874 stripchart . . . 874 strwidth . . . 876 sunflowerplot . . . 878 symbols . . . 880 text . . . 882 title . . . 884 units . . . 886 xspline . . . 887

6 The grid package 891 grid-package . . . 891 absolute.size . . . 892 arrow . . . 893 calcStringMetric . . . 893 dataViewport . . . 895 depth . . . 896 drawDetails . . . 897 editDetails . . . 898 explode . . . 899 gEdit . . . 899 getNames . . . 900 gpar . . . 901 gPath . . . 903 Grid . . . 904 Grid Viewports . . . 904 grid.add . . . 907 grid.bezier . . . 909 grid.cap . . . 910 grid.circle . . . 911 grid.clip . . . 912 grid.convert . . . 913 grid.copy . . . 915 grid.curve . . . 916 grid.delay . . . 918 grid.display.list . . . 919 grid.DLapply . . . 920 grid.draw . . . 921

(15)

xiv CONTENTS grid.edit . . . 922 grid.force . . . 923 grid.frame . . . 925 grid.function . . . 926 grid.get . . . 928 grid.grab . . . 929 grid.grep . . . 930 grid.grill . . . 932 grid.grob . . . 932 grid.layout . . . 934 grid.lines . . . 936 grid.locator . . . 937 grid.ls . . . 939 grid.move.to . . . 941 grid.newpage . . . 942 grid.null . . . 943 grid.pack . . . 944 grid.path . . . 945 grid.place . . . 947 grid.plot.and.legend . . . 948 grid.points . . . 949 grid.polygon . . . 950 grid.pretty . . . 951 grid.raster . . . 952 grid.record . . . 953 grid.rect . . . 954 grid.refresh . . . 956 grid.remove . . . 956 grid.reorder . . . 957 grid.segments . . . 959 grid.set . . . 960 grid.show.layout . . . 961 grid.show.viewport . . . 962 grid.text . . . 963 grid.xaxis . . . 965 grid.xspline . . . 966 grid.yaxis . . . 968 grobName . . . 970 grobWidth . . . 970 grobX . . . 971 legendGrob . . . 972 makeContent . . . 973 plotViewport . . . 974

Querying the Viewport Tree . . . 975

resolveRasterSize . . . 976 roundrect . . . 977 showGrob . . . 978 showViewport . . . 979 stringWidth . . . 981 unit . . . 981 unit.c . . . 983 unit.length . . . 984

(16)

CONTENTS xv unit.pmin . . . 984 unit.rep . . . 985 valid.just . . . 986 validDetails . . . 987 vpPath . . . 987 widthDetails . . . 988

Working with Viewports . . . 989

xDetails . . . 991

xsplinePoints . . . 992

7 The methods package 995 methods-package . . . 995 .BasicFunsList . . . 996 as . . . 996 BasicClasses . . . 1000 callGeneric . . . 1002 callNextMethod . . . 1003 canCoerce . . . 1005 cbind2 . . . 1006 Classes . . . 1007 classesToAM . . . 1010 className . . . 1012 classRepresentation-class . . . 1014 Documentation . . . 1015 dotsMethods . . . 1016 environment-class . . . 1019 envRefClass-class . . . 1020 evalSource . . . 1021 findClass . . . 1024 findMethods . . . 1025 fixPre1.8 . . . 1028 genericFunction-class . . . 1029 GenericFunctions . . . 1030 getClass . . . 1033 getMethod . . . 1035 getPackageName . . . 1037 hasArg . . . 1038 implicitGeneric . . . 1039 inheritedSlotNames . . . 1041 initialize-methods . . . 1042 is . . . 1043 isSealedMethod . . . 1048 language-class . . . 1050 LinearMethodsList-class . . . 1050 LocalReferenceClasses . . . 1051 makeClassRepresentation . . . 1052 method.skeleton . . . 1054 MethodDefinition-class . . . 1055 Methods . . . 1056 MethodsList-class . . . 1063 MethodWithNext-class . . . 1064 new . . . 1065 nonStructure-class . . . 1067

(17)

xvi CONTENTS ObjectsWithPackage-class . . . 1068 promptClass . . . 1069 promptMethods . . . 1070 ReferenceClasses . . . 1071 representation . . . 1081 S3Part . . . 1082 S4groupGeneric . . . 1086 SClassExtension-class . . . 1088 selectSuperClasses . . . 1089 setClass . . . 1090 setClassUnion . . . 1094 setGeneric . . . 1095 setLoadActions . . . 1100 setMethod . . . 1103 setOldClass . . . 1106 show . . . 1110 showMethods . . . 1112 signature-class . . . 1114 slot . . . 1114 StructureClasses . . . 1116 testInheritedMethods . . . 1118 TraceClasses . . . 1120 validObject . . . 1121

8 The parallel package 1125 parallel-package . . . 1125 clusterApply . . . 1126 detectCores . . . 1129 makeCluster . . . 1130 mcaffinity . . . 1132 mcchildren . . . 1133 mcfork . . . 1135 mclapply . . . 1136 mcparallel . . . 1139 pvec . . . 1141 RNGstreams . . . 1143 splitIndices . . . 1145

9 The splines package 1147 splines-package . . . 1147 asVector . . . 1147 backSpline . . . 1148 bs . . . 1149 interpSpline . . . 1150 ns . . . 1151 periodicSpline . . . 1152 polySpline . . . 1153 predict.bs . . . 1154 predict.bSpline . . . 1155 splineDesign . . . 1156 splineKnots . . . 1158 splineOrder . . . 1158 xyVector . . . 1159

(18)

CONTENTS xvii

10 The stats package 1161

stats-package . . . 1161 .checkMFClasses . . . 1161 acf . . . 1162 acf2AR . . . 1164 add1 . . . 1165 addmargins . . . 1167 aggregate . . . 1169 AIC . . . 1172 alias . . . 1173 anova . . . 1175 anova.glm . . . 1175 anova.lm . . . 1177 anova.mlm . . . 1178 ansari.test . . . 1180 aov . . . 1183 approxfun . . . 1184 ar . . . 1186 ar.ols . . . 1189 arima . . . 1191 arima.sim . . . 1195 arima0 . . . 1196 ARMAacf . . . 1200 ARMAtoMA . . . 1201 as.hclust . . . 1202 asOneSidedFormula . . . 1203 ave . . . 1203 bandwidth . . . 1204 bartlett.test . . . 1206 Beta . . . 1207 binom.test . . . 1210 Binomial . . . 1212 biplot . . . 1213 biplot.princomp . . . 1215 birthday . . . 1216 Box.test . . . 1217 C . . . 1218 cancor . . . 1219 case+variable.names . . . 1221 Cauchy . . . 1222 chisq.test . . . 1223 Chisquare . . . 1225 cmdscale . . . 1228 coef . . . 1230 complete.cases . . . 1231 confint . . . 1231 constrOptim . . . 1232 contrast . . . 1234 contrasts . . . 1236 convolve . . . 1237 cophenetic . . . 1238 cor . . . 1240

(19)

xviii CONTENTS cor.test . . . 1243 cov.wt . . . 1245 cpgram . . . 1247 cutree . . . 1248 decompose . . . 1249 delete.response . . . 1250 dendrapply . . . 1251 dendrogram . . . 1253 density . . . 1257 deriv . . . 1261 deviance . . . 1263 df.residual . . . 1264 diffinv . . . 1265 dist . . . 1266 Distributions . . . 1269 dummy.coef . . . 1270 ecdf . . . 1271 eff.aovlist . . . 1273 effects . . . 1275 embed . . . 1276 expand.model.frame . . . 1277 Exponential . . . 1278 extractAIC . . . 1279 factanal . . . 1281 factor.scope . . . 1284 family . . . 1285 FDist . . . 1288 fft . . . 1290 filter . . . 1291 fisher.test . . . 1293 fitted . . . 1295 fivenum . . . 1296 fligner.test . . . 1297 formula . . . 1298 formula.nls . . . 1301 friedman.test . . . 1301 ftable . . . 1303 ftable.formula . . . 1305 GammaDist . . . 1306 Geometric . . . 1309 getInitial . . . 1310 glm . . . 1311 glm.control . . . 1316 glm.summaries . . . 1317 hclust . . . 1318 heatmap . . . 1321 HoltWinters . . . 1324 Hypergeometric . . . 1327 identify.hclust . . . 1328 influence.measures . . . 1330 integrate . . . 1333 interaction.plot . . . 1335

(20)

CONTENTS xix IQR . . . 1337 is.empty.model . . . 1338 isoreg . . . 1338 KalmanLike . . . 1340 kernapply . . . 1342 kernel . . . 1343 kmeans . . . 1345 kruskal.test . . . 1347 ks.test . . . 1349 ksmooth . . . 1351 lag . . . 1352 lag.plot . . . 1353 line . . . 1354 listof . . . 1355 lm . . . 1356 lm.fit . . . 1359 lm.influence . . . 1361 lm.summaries . . . 1362 loadings . . . 1364 loess . . . 1365 loess.control . . . 1367 Logistic . . . 1368 logLik . . . 1369 loglin . . . 1371 Lognormal . . . 1373 lowess . . . 1374 ls.diag . . . 1375 ls.print . . . 1377 lsfit . . . 1377 mad . . . 1379 mahalanobis . . . 1380 make.link . . . 1381 makepredictcall . . . 1381 manova . . . 1382 mantelhaen.test . . . 1383 mauchly.test . . . 1386 mcnemar.test . . . 1388 median . . . 1389 medpolish . . . 1390 model.extract . . . 1391 model.frame . . . 1392 model.matrix . . . 1394 model.tables . . . 1396 monthplot . . . 1397 mood.test . . . 1399 Multinom . . . 1401 na.action . . . 1402 na.contiguous . . . 1403 na.fail . . . 1403 naprint . . . 1404 naresid . . . 1405 NegBinomial . . . 1406

(21)

xx CONTENTS nextn . . . 1408 nlm . . . 1408 nlminb . . . 1411 nls . . . 1414 nls.control . . . 1419 NLSstAsymptotic . . . 1420 NLSstClosestX . . . 1421 NLSstLfAsymptote . . . 1421 NLSstRtAsymptote . . . 1422 nobs . . . 1423 Normal . . . 1424 numericDeriv . . . 1426 offset . . . 1427 oneway.test . . . 1427 optim . . . 1429 optimize . . . 1434 order.dendrogram . . . 1436 p.adjust . . . 1437 pairwise.prop.test . . . 1439 pairwise.t.test . . . 1440 pairwise.table . . . 1441 pairwise.wilcox.test . . . 1441 plot.acf . . . 1442 plot.density . . . 1443 plot.HoltWinters . . . 1444 plot.isoreg . . . 1445 plot.lm . . . 1447 plot.ppr . . . 1449 plot.profile.nls . . . 1450 plot.spec . . . 1451 plot.stepfun . . . 1453 plot.ts . . . 1454 Poisson . . . 1456 poisson.test . . . 1458 poly . . . 1459 power . . . 1461 power.anova.test . . . 1462 power.prop.test . . . 1463 power.t.test . . . 1464 PP.test . . . 1465 ppoints . . . 1467 ppr . . . 1468 prcomp . . . 1471 predict . . . 1473 predict.Arima . . . 1474 predict.glm . . . 1475 predict.HoltWinters . . . 1477 predict.lm . . . 1478 predict.loess . . . 1480 predict.nls . . . 1482 predict.smooth.spline . . . 1483 preplot . . . 1485

(22)

CONTENTS xxi princomp . . . 1485 print.power.htest . . . 1488 print.ts . . . 1489 printCoefmat . . . 1489 profile . . . 1491 profile.nls . . . 1492 proj . . . 1493 prop.test . . . 1495 prop.trend.test . . . 1497 qqnorm . . . 1498 quade.test . . . 1499 quantile . . . 1501 r2dtable . . . 1503 read.ftable . . . 1504 rect.hclust . . . 1506 relevel . . . 1507 reorder.default . . . 1508 reorder.dendrogram . . . 1509 replications . . . 1510 reshape . . . 1511 residuals . . . 1514 runmed . . . 1515 rWishart . . . 1517 scatter.smooth . . . 1518 screeplot . . . 1519 sd . . . 1520 se.contrast . . . 1521 selfStart . . . 1523 setNames . . . 1524 shapiro.test . . . 1525 SignRank . . . 1526 simulate . . . 1527 smooth . . . 1529 smooth.spline . . . 1531 smoothEnds . . . 1535 sortedXyData . . . 1536 spec.ar . . . 1537 spec.pgram . . . 1538 spec.taper . . . 1540 spectrum . . . 1541 splinefun . . . 1543 SSasymp . . . 1546 SSasympOff . . . 1547 SSasympOrig . . . 1548 SSbiexp . . . 1549 SSD . . . 1550 SSfol . . . 1551 SSfpl . . . 1552 SSgompertz . . . 1553 SSlogis . . . 1554 SSmicmen . . . 1555 SSweibull . . . 1556

(23)

xxii CONTENTS start . . . 1557 stat.anova . . . 1558 stats-deprecated . . . 1559 step . . . 1560 stepfun . . . 1562 stl . . . 1564 stlmethods . . . 1566 StructTS . . . 1567 summary.aov . . . 1569 summary.glm . . . 1571 summary.lm . . . 1573 summary.manova . . . 1575 summary.nls . . . 1576 summary.princomp . . . 1578 supsmu . . . 1579 symnum . . . 1580 t.test . . . 1582 TDist . . . 1584 termplot . . . 1586 terms . . . 1588 terms.formula . . . 1589 terms.object . . . 1590 time . . . 1591 toeplitz . . . 1592 ts . . . 1593 ts-methods . . . 1595 ts.plot . . . 1596 ts.union . . . 1596 tsdiag . . . 1597 tsp . . . 1598 tsSmooth . . . 1599 Tukey . . . 1600 TukeyHSD . . . 1601 Uniform . . . 1603 uniroot . . . 1604 update . . . 1607 update.formula . . . 1609 var.test . . . 1610 varimax . . . 1611 vcov . . . 1612 Weibull . . . 1613 weighted.mean . . . 1614 weighted.residuals . . . 1616 weights . . . 1617 wilcox.test . . . 1617 Wilcoxon . . . 1620 window . . . 1622 xtabs . . . 1624

(24)

CONTENTS xxiii

11 The stats4 package 1627

stats4-package . . . 1627 coef-methods . . . 1627 confint-methods . . . 1628 logLik-methods . . . 1628 mle . . . 1628 mle-class . . . 1630 plot-methods . . . 1631 profile-methods . . . 1632 profile.mle-class . . . 1633 show-methods . . . 1633 summary-methods . . . 1634 summary.mle-class . . . 1634 update-methods . . . 1635 vcov-methods . . . 1635 12 The tcltk package 1637 tcltk-package . . . 1637 TclInterface . . . 1637 tclServiceMode . . . 1642 TkCommands . . . 1642 tkpager . . . 1646 tkProgressBar . . . 1647 tkStartGUI . . . 1648 TkWidgetcmds . . . 1648 TkWidgets . . . 1651 tk_choose.dir . . . 1653 tk_choose.files . . . 1654 tk_messageBox . . . 1655 tk_select.list . . . 1655

13 The tools package 1657

tools-package . . . 1657 .print.via.format . . . 1657 add_datalist . . . 1658 assertCondition . . . 1659 bibstyle . . . 1660 buildVignette . . . 1662 buildVignettes . . . 1663 charsets . . . 1664 checkFF . . . 1665 checkMD5sums . . . 1667 checkPoFiles . . . 1667 checkRd . . . 1669 checkRdaFiles . . . 1671 checkTnF . . . 1672 checkVignettes . . . 1672 check_packages_in_dir . . . 1674 codoc . . . 1675 compactPDF . . . 1677 delimMatch . . . 1678 dependsOnPkgs . . . 1679 encoded_text_to_latex . . . 1680

(25)

xxiv CONTENTS fileutils . . . 1681 find_gs_cmd . . . 1683 getDepList . . . 1684 getVignetteInfo . . . 1685 HTMLheader . . . 1686 HTMLlinks . . . 1687 installFoundDepends . . . 1688 make_translations_pkg . . . 1689 md5sum . . . 1689 package.dependencies . . . 1690 package_dependencies . . . 1691 parseLatex . . . 1692 parse_Rd . . . 1693 pskill . . . 1694 psnice . . . 1695 QC . . . 1696 Rd2HTML . . . 1697 Rd2txt_options . . . 1700 Rdiff . . . 1701 Rdindex . . . 1702 RdTextFilter . . . 1703 Rdutils . . . 1704 read.00Index . . . 1705 showNonASCII . . . 1705 startDynamicHelp . . . 1706 SweaveTeXFilter . . . 1707 testInstalledPackage . . . 1708 texi2dvi . . . 1709 toHTML . . . 1710 tools-deprecated . . . 1711 toRd . . . 1711 undoc . . . 1712 update_pkg_po . . . 1713 vignetteDepends . . . 1714 vignetteEngine . . . 1715 write_PACKAGES . . . 1716 xgettext . . . 1718

14 The utils package 1721

utils-package . . . 1721 adist . . . 1721 alarm . . . 1723 apropos . . . 1724 aregexec . . . 1725 aspell . . . 1727 aspell-utils . . . 1728 available.packages . . . 1730 BATCH . . . 1732 bibentry . . . 1733 browseEnv . . . 1736 browseURL . . . 1738 browseVignettes . . . 1739 bug.report . . . 1740

(26)

CONTENTS xxv capture.output . . . 1742 changedFiles . . . 1743 chooseBioCmirror . . . 1745 chooseCRANmirror . . . 1746 citation . . . 1747 cite . . . 1748 citEntry . . . 1751 close.socket . . . 1752 combn . . . 1752 compareVersion . . . 1754 COMPILE . . . 1755 contrib.url . . . 1756 count.fields . . . 1756 create.post . . . 1757 data . . . 1759 dataentry . . . 1761 debugger . . . 1763 demo . . . 1765 download.file . . . 1766 download.packages . . . 1768 edit . . . 1770 edit.data.frame . . . 1771 example . . . 1773 file.edit . . . 1775 file_test . . . 1776 findLineNum . . . 1776 fix . . . 1778 flush.console . . . 1779 format . . . 1779 getAnywhere . . . 1780 getFromNamespace . . . 1781 getParseData . . . 1783 getS3method . . . 1785 glob2rx . . . 1786 globalVariables . . . 1787 head . . . 1789 help . . . 1790 help.request . . . 1793 help.search . . . 1794 help.start . . . 1797 INSTALL . . . 1798 install.packages . . . 1800 installed.packages . . . 1804 LINK . . . 1805 localeToCharset . . . 1806 ls.str . . . 1807 maintainer . . . 1808 make.packages.html . . . 1809 make.socket . . . 1810 memory.size . . . 1811 menu . . . 1812 methods . . . 1813

(27)

xxvi CONTENTS mirrorAdmin . . . 1814 modifyList . . . 1815 news . . . 1815 nsl . . . 1817 object.size . . . 1818 package.skeleton . . . 1819 packageDescription . . . 1820 packageName . . . 1822 packageStatus . . . 1822 page . . . 1824 person . . . 1825 PkgUtils . . . 1827 process.events . . . 1828 prompt . . . 1829 promptData . . . 1831 promptPackage . . . 1832 Question . . . 1833 rcompgen . . . 1835 read.DIF . . . 1840 read.fortran . . . 1842 read.fwf . . . 1843 read.socket . . . 1845 read.table . . . 1846 recover . . . 1850 relist . . . 1852 REMOVE . . . 1854 remove.packages . . . 1855 removeSource . . . 1855 RHOME . . . 1856 roman . . . 1856 Rprof . . . 1857 Rprofmem . . . 1858 Rscript . . . 1860 RShowDoc . . . 1861 RSiteSearch . . . 1862 rtags . . . 1863 Rtangle . . . 1865 RweaveLatex . . . 1866 savehistory . . . 1870 select.list . . . 1871 sessionInfo . . . 1872 setRepositories . . . 1874 SHLIB . . . 1875 sourceutils . . . 1876 stack . . . 1877 str . . . 1878 summaryRprof . . . 1881 Sweave . . . 1883 SweaveSyntConv . . . 1885 tar . . . 1886 toLatex . . . 1888 txtProgressBar . . . 1889

(28)

CONTENTS xxvii type.convert . . . 1890 untar . . . 1891 unzip . . . 1893 update.packages . . . 1894 url.show . . . 1897 URLencode . . . 1897 utils-deprecated . . . 1898 View . . . 1898 vignette . . . 1899 write.table . . . 1901 zip . . . 1903

II

1905

15 The KernSmooth package 1907

bkde . . . 1907 bkde2D . . . 1908 bkfe . . . 1910 dpih . . . 1911 dpik . . . 1912 dpill . . . 1913 locpoly . . . 1915

16 The MASS package 1917

abbey . . . 1917 accdeaths . . . 1917 addterm . . . 1918 Aids2 . . . 1919 Animals . . . 1920 anorexia . . . 1921 anova.negbin . . . 1921 area . . . 1922 bacteria . . . 1923 bandwidth.nrd . . . 1925 bcv . . . 1925 beav1 . . . 1926 beav2 . . . 1927 Belgian-phones . . . 1928 biopsy . . . 1929 birthwt . . . 1930 Boston . . . 1931 boxcox . . . 1932 cabbages . . . 1933 caith . . . 1934 Cars93 . . . 1934 cats . . . 1936 cement . . . 1936 chem . . . 1937 con2tr . . . 1937 confint-MASS . . . 1938 contr.sdif . . . 1939 coop . . . 1940

(29)

xxviii CONTENTS corresp . . . 1941 cov.rob . . . 1942 cov.trob . . . 1944 cpus . . . 1945 crabs . . . 1946 Cushings . . . 1947 DDT . . . 1947 deaths . . . 1948 denumerate . . . 1948 dose.p . . . 1949 drivers . . . 1950 dropterm . . . 1950 eagles . . . 1952 epil . . . 1953 eqscplot . . . 1954 farms . . . 1955 fgl . . . 1956 fitdistr . . . 1956 forbes . . . 1958 fractions . . . 1959 GAGurine . . . 1960 galaxies . . . 1960 gamma.dispersion . . . 1961 gamma.shape . . . 1962 gehan . . . 1963 genotype . . . 1964 geyser . . . 1965 gilgais . . . 1965 ginv . . . 1966 glm.convert . . . 1967 glm.nb . . . 1968 glmmPQL . . . 1969 hills . . . 1970 hist.scott . . . 1971 housing . . . 1971 huber . . . 1973 hubers . . . 1974 immer . . . 1975 Insurance . . . 1976 isoMDS . . . 1977 kde2d . . . 1978 lda . . . 1979 ldahist . . . 1981 leuk . . . 1983 lm.gls . . . 1984 lm.ridge . . . 1985 loglm . . . 1986 logtrans . . . 1988 lqs . . . 1989 mammals . . . 1992 mca . . . 1993 mcycle . . . 1994

(30)

CONTENTS xxix Melanoma . . . 1994 menarche . . . 1995 michelson . . . 1996 minn38 . . . 1996 motors . . . 1997 muscle . . . 1998 mvrnorm . . . 1999 negative.binomial . . . 2000 newcomb . . . 2001 nlschools . . . 2001 npk . . . 2002 npr1 . . . 2003 Null . . . 2004 oats . . . 2005 OME . . . 2006 painters . . . 2008 pairs.lda . . . 2009 parcoord . . . 2010 petrol . . . 2011 Pima.tr . . . 2012 plot.lda . . . 2013 plot.mca . . . 2014 plot.profile . . . 2014 polr . . . 2015 predict.glmmPQL . . . 2018 predict.lda . . . 2019 predict.lqs . . . 2020 predict.mca . . . 2021 predict.qda . . . 2022 profile.glm . . . 2023 qda . . . 2024 quine . . . 2026 Rabbit . . . 2027 rational . . . 2028 renumerate . . . 2029 rlm . . . 2029 rms.curv . . . 2032 rnegbin . . . 2033 road . . . 2034 rotifer . . . 2034 Rubber . . . 2035 sammon . . . 2035 ships . . . 2037 shoes . . . 2037 shrimp . . . 2038 shuttle . . . 2038 Sitka . . . 2039 Sitka89 . . . 2039 Skye . . . 2040 snails . . . 2041 SP500 . . . 2042 stdres . . . 2043

(31)

xxx CONTENTS steam . . . 2043 stepAIC . . . 2044 stormer . . . 2046 studres . . . 2047 summary.loglm . . . 2047 summary.negbin . . . 2048 summary.rlm . . . 2049 survey . . . 2050 synth.tr . . . 2051 theta.md . . . 2052 topo . . . 2053 Traffic . . . 2054 truehist . . . 2054 ucv . . . 2056 UScereal . . . 2056 UScrime . . . 2057 VA . . . 2058 waders . . . 2059 whiteside . . . 2060 width.SJ . . . 2061 write.matrix . . . 2062 wtloss . . . 2063

17 The Matrix package 2065

abIndex-class . . . 2065 abIseq . . . 2066 all-methods . . . 2067 all.equal-methods . . . 2068 atomicVector-class . . . 2068 band . . . 2069 bandSparse . . . 2070 bdiag . . . 2071 BunchKaufman-methods . . . 2072 CAex . . . 2073 cBind . . . 2074 CHMfactor-class . . . 2075 chol . . . 2078 chol2inv-methods . . . 2080 Cholesky . . . 2080 Cholesky-class . . . 2083 colSums . . . 2084 compMatrix-class . . . 2086 condest . . . 2086 CsparseMatrix-class . . . 2088 ddenseMatrix-class . . . 2090 ddiMatrix-class . . . 2090 denseMatrix-class . . . 2091 dgCMatrix-class . . . 2092 dgeMatrix-class . . . 2093 dgRMatrix-class . . . 2094 dgTMatrix-class . . . 2095 Diagonal . . . 2096 diagonalMatrix-class . . . 2098

(32)

CONTENTS xxxi diagU2N . . . 2099 dMatrix-class . . . 2101 dpoMatrix-class . . . 2102 drop0 . . . 2103 dsCMatrix-class . . . 2104 dsparseMatrix-class . . . 2106 dsRMatrix-class . . . 2107 dsyMatrix-class . . . 2108 dtCMatrix-class . . . 2109 dtpMatrix-class . . . 2111 dtRMatrix-class . . . 2112 dtrMatrix-class . . . 2113 expand . . . 2115 expm . . . 2116 externalFormats . . . 2117 facmul . . . 2118 forceSymmetric . . . 2119 formatSparseM . . . 2120 generalMatrix-class . . . 2121 graph-sparseMatrix . . . 2122 Hilbert . . . 2123 image-methods . . . 2124 index-class . . . 2126 indMatrix-class . . . 2126 invPerm . . . 2128 is.na-methods . . . 2129 is.null.DN . . . 2131 isSymmetric-methods . . . 2132 isTriangular . . . 2132 KhatriRao . . . 2133 KNex . . . 2134 kronecker-methods . . . 2135 ldenseMatrix-class . . . 2136 ldiMatrix-class . . . 2137 lgeMatrix-class . . . 2137 lsparseMatrix-classes . . . 2138 lsyMatrix-class . . . 2140 ltrMatrix-class . . . 2141 lu . . . 2142 LU-class . . . 2143 Matrix . . . 2145 Matrix-class . . . 2146 matrix-products . . . 2148 MatrixFactorization-class . . . 2150 ndenseMatrix-class . . . 2151 nearPD . . . 2152 ngeMatrix-class . . . 2155 nMatrix-class . . . 2156 nnzero . . . 2157 norm . . . 2158 nsparseMatrix-classes . . . 2159 nsyMatrix-class . . . 2160

(33)

xxxii CONTENTS ntrMatrix-class . . . 2161 number-class . . . 2162 pMatrix-class . . . 2163 printSpMatrix . . . 2165 qr-methods . . . 2167 rankMatrix . . . 2168 rcond . . . 2170 rep2abI . . . 2172 replValue-class . . . 2173 rleDiff-class . . . 2173 rsparsematrix . . . 2174 RsparseMatrix-class . . . 2175 Schur . . . 2176 Schur-class . . . 2177 solve-methods . . . 2178 sparse.model.matrix . . . 2181 sparseLU-class . . . 2183 SparseM-conversions . . . 2184 sparseMatrix . . . 2185 sparseMatrix-class . . . 2188 sparseQR-class . . . 2190 sparseVector . . . 2191 sparseVector-class . . . 2192 spMatrix . . . 2195 symmetricMatrix-class . . . 2196 symmpart . . . 2197 triangularMatrix-class . . . 2198 TsparseMatrix-class . . . 2199 unpack . . . 2200 Unused-classes . . . 2201 updown . . . 2202 USCounties . . . 2203 [-methods . . . 2204 [<–methods . . . 2205

18 The boot package 2207

abc.ci . . . 2207 acme . . . 2208 aids . . . 2209 aircondit . . . 2210 amis . . . 2211 aml . . . 2212 beaver . . . 2213 bigcity . . . 2214 boot . . . 2214 boot.array . . . 2220 boot.ci . . . 2221 brambles . . . 2224 breslow . . . 2225 calcium . . . 2226 cane . . . 2227 capability . . . 2228 catsM . . . 2228

(34)

CONTENTS xxxiii cav . . . 2229 cd4 . . . 2230 cd4.nested . . . 2230 censboot . . . 2231 channing . . . 2235 claridge . . . 2236 cloth . . . 2237 co.transfer . . . 2238 coal . . . 2238 control . . . 2239 corr . . . 2241 cum3 . . . 2242 cv.glm . . . 2242 darwin . . . 2244 dogs . . . 2245 downs.bc . . . 2246 ducks . . . 2247 EEF.profile . . . 2247 empinf . . . 2249 envelope . . . 2251 exp.tilt . . . 2253 fir . . . 2255 freq.array . . . 2255 frets . . . 2256 glm.diag . . . 2257 glm.diag.plots . . . 2258 gravity . . . 2259 hirose . . . 2260 Imp.Estimates . . . 2261 imp.weights . . . 2263 inv.logit . . . 2264 islay . . . 2265 jack.after.boot . . . 2265 k3.linear . . . 2267 linear.approx . . . 2268 lines.saddle.distn . . . 2270 logit . . . 2272 manaus . . . 2272 melanoma . . . 2273 motor . . . 2274 neuro . . . 2275 nitrofen . . . 2275 nodal . . . 2276 norm.ci . . . 2277 nuclear . . . 2279 paulsen . . . 2280 plot.boot . . . 2280 poisons . . . 2283 polar . . . 2283 print.boot . . . 2284 print.bootci . . . 2285 print.saddle.distn . . . 2286

(35)

xxxiv CONTENTS print.simplex . . . 2286 remission . . . 2287 saddle . . . 2288 saddle.distn . . . 2290 saddle.distn.object . . . 2293 salinity . . . 2294 simplex . . . 2294 simplex.object . . . 2296 smooth.f . . . 2297 sunspot . . . 2299 survival . . . 2299 tau . . . 2300 tilt.boot . . . 2301 tsboot . . . 2304 tuna . . . 2307 urine . . . 2308 var.linear . . . 2309 wool . . . 2309

19 The class package 2311

batchSOM . . . 2311 condense . . . 2312 knn . . . 2313 knn.cv . . . 2314 knn1 . . . 2315 lvq1 . . . 2316 lvq2 . . . 2317 lvq3 . . . 2318 lvqinit . . . 2319 lvqtest . . . 2320 multiedit . . . 2321 olvq1 . . . 2322 reduce.nn . . . 2323 SOM . . . 2324 somgrid . . . 2325

20 The cluster package 2327

agnes . . . 2327 agnes.object . . . 2331 agriculture . . . 2332 animals . . . 2333 bannerplot . . . 2334 chorSub . . . 2336 clara . . . 2337 clara.object . . . 2339 clusGap . . . 2340 clusplot . . . 2343 clusplot.default . . . 2345 coef.hclust . . . 2349 daisy . . . 2350 diana . . . 2352 dissimilarity.object . . . 2355 ellipsoidhull . . . 2356

(36)

CONTENTS xxxv fanny . . . 2358 fanny.object . . . 2360 flower . . . 2361 lower.to.upper.tri.inds . . . 2362 mona . . . 2363 mona.object . . . 2364 pam . . . 2365 pam.object . . . 2368 partition.object . . . 2369 plantTraits . . . 2370 plot.agnes . . . 2372 plot.diana . . . 2374 plot.mona . . . 2375 plot.partition . . . 2376 pltree . . . 2378 pluton . . . 2379 predict.ellipsoid . . . 2380 print.agnes . . . 2381 print.clara . . . 2382 print.diana . . . 2383 print.dissimilarity . . . 2383 print.fanny . . . 2384 print.mona . . . 2385 print.pam . . . 2385 ruspini . . . 2386 silhouette . . . 2386 sizeDiss . . . 2390 summary.agnes . . . 2390 summary.clara . . . 2391 summary.diana . . . 2392 summary.mona . . . 2393 summary.pam . . . 2393 twins.object . . . 2394 volume.ellipsoid . . . 2394 votes.repub . . . 2395 xclara . . . 2395

21 The codetools package 2397

checkUsage . . . 2397

codetools . . . 2398

findGlobals . . . 2400

showTree . . . 2400

22 The foreign package 2403

lookup.xport . . . 2403 read.arff . . . 2404 read.dbf . . . 2404 read.dta . . . 2406 read.epiinfo . . . 2407 read.mtp . . . 2408 read.octave . . . 2409 read.spss . . . 2410 read.ssd . . . 2412

(37)

xxxvi CONTENTS read.systat . . . 2414 read.xport . . . 2415 S3 read functions . . . 2416 write.arff . . . 2417 write.dbf . . . 2418 write.dta . . . 2419 write.foreign . . . 2421

23 The lattice package 2423

A_01_Lattice . . . 2423 B_00_xyplot . . . 2426 B_01_xyplot.ts . . . 2443 B_02_barchart.table . . . 2446 B_03_histogram . . . 2448 B_04_qqmath . . . 2452 B_05_qq . . . 2455 B_06_levelplot . . . 2457 B_07_cloud . . . 2462 B_08_splom . . . 2467 B_09_tmd . . . 2470 B_10_rfs . . . 2472 B_11_oneway . . . 2473 C_01_trellis.device . . . 2474 C_02_trellis.par.get . . . 2476 C_03_simpleTheme . . . 2479 C_04_lattice.options . . . 2480 C_05_print.trellis . . . 2482 C_06_update.trellis . . . 2485 C_07_shingles . . . 2488 D_draw.colorkey . . . 2489 D_draw.key . . . 2490 D_level.colors . . . 2491 D_make.groups . . . 2492 D_simpleKey . . . 2493 D_strip.default . . . 2494 D_trellis.object . . . 2496 E_interaction . . . 2497 F_1_panel.barchart . . . 2503 F_1_panel.bwplot . . . 2505 F_1_panel.cloud . . . 2507 F_1_panel.densityplot . . . 2511 F_1_panel.dotplot . . . 2512 F_1_panel.histogram . . . 2513 F_1_panel.levelplot . . . 2514 F_1_panel.pairs . . . 2516 F_1_panel.parallel . . . 2519 F_1_panel.qqmath . . . 2520 F_1_panel.stripplot . . . 2522 F_1_panel.xyplot . . . 2523 F_2_llines . . . 2525 F_2_panel.functions . . . 2528 F_2_panel.loess . . . 2531 F_2_panel.qqmathline . . . 2532

(38)

CONTENTS xxxvii F_2_panel.smoothScatter . . . 2533 F_2_panel.spline . . . 2534 F_2_panel.superpose . . . 2536 F_2_panel.violin . . . 2538 F_3_prepanel.default . . . 2539 F_3_prepanel.functions . . . 2541 G_axis.default . . . 2542 G_banking . . . 2545 G_latticeParseFormula . . . 2546 G_packet.panel.default . . . 2547 G_panel.axis . . . 2549 G_panel.number . . . 2551 G_Rows . . . 2552 G_utilities.3d . . . 2553 H_barley . . . 2554 H_environmental . . . 2555 H_ethanol . . . 2556 H_melanoma . . . 2557 H_singer . . . 2558 I_lset . . . 2559 24 The mgcv package 2561 anova.gam . . . 2561 bam . . . 2563 bam.update . . . 2568 betar . . . 2569 choose.k . . . 2570 columb . . . 2573 concurvity . . . 2574 cox.ph . . . 2575 cSplineDes . . . 2577 exclude.too.far . . . 2579 extract.lme.cov . . . 2580 family.mgcv . . . 2581 fix.family.link . . . 2582 fixDependence . . . 2584 formula.gam . . . 2585 formXtViX . . . 2586 fs.test . . . 2588 full.score . . . 2589 gam . . . 2590 gam.check . . . 2599 gam.control . . . 2601 gam.convergence . . . 2603 gam.fit . . . 2604 gam.fit3 . . . 2605 gam.models . . . 2607 gam.outer . . . 2613 gam.scale . . . 2615 gam.selection . . . 2615 gam.side . . . 2618 gam.vcomp . . . 2620 gam2objective . . . 2621

(39)

xxxviii CONTENTS gamm . . . 2622 gamObject . . . 2628 gamSim . . . 2631 gaulss . . . 2632 get.var . . . 2633 in.out . . . 2634 influence.gam . . . 2635 initial.sp . . . 2636 inSide . . . 2637 interpret.gam . . . 2638 jagam . . . 2639 ldTweedie . . . 2643 linear.functional.terms . . . 2645 logLik.gam . . . 2648 ls.size . . . 2649 magic . . . 2650 magic.post.proc . . . 2654 mgcv.FAQ . . . 2655 mgcv.package . . . 2657 mgcv.parallel . . . 2659 model.matrix.gam . . . 2660 mono.con . . . 2661 mroot . . . 2662 mvn . . . 2663 negbin . . . 2664 new.name . . . 2667 notExp . . . 2668 notExp2 . . . 2669 null.space.dimension . . . 2670 ocat . . . 2671 pcls . . . 2673 pdIdnot . . . 2676 pdTens . . . 2677 pen.edf . . . 2679 place.knots . . . 2680 plot.gam . . . 2681 polys.plot . . . 2685 predict.bam . . . 2686 predict.gam . . . 2689 Predict.matrix . . . 2693 Predict.matrix.cr.smooth . . . 2694 Predict.matrix.soap.film . . . 2695 print.gam . . . 2697 qq.gam . . . 2698 random.effects . . . 2701 residuals.gam . . . 2702 rig . . . 2703 Rrank . . . 2704 rTweedie . . . 2705 s . . . 2706 scat . . . 2708 slanczos . . . 2709

(40)

CONTENTS xxxix smooth.construct . . . 2711 smooth.construct.ad.smooth.spec . . . 2716 smooth.construct.cr.smooth.spec . . . 2718 smooth.construct.ds.smooth.spec . . . 2720 smooth.construct.fs.smooth.spec . . . 2722 smooth.construct.mrf.smooth.spec . . . 2724 smooth.construct.ps.smooth.spec . . . 2726 smooth.construct.re.smooth.spec . . . 2728 smooth.construct.so.smooth.spec . . . 2730 smooth.construct.sos.smooth.spec . . . 2736 smooth.construct.t2.smooth.spec . . . 2738 smooth.construct.tensor.smooth.spec . . . 2739 smooth.construct.tp.smooth.spec . . . 2740 smooth.terms . . . 2743 smoothCon . . . 2745 sp.vcov . . . 2748 spasm.construct . . . 2749 step.gam . . . 2750 summary.gam . . . 2751 t2 . . . 2755 te . . . 2759 tensor.prod.model.matrix . . . 2764 Tweedie . . . 2765 uniquecombs . . . 2767 vcov.gam . . . 2768 vis.gam . . . 2769 ziP . . . 2771 ziplss . . . 2773

25 The nlme package 2775

ACF . . . 2775 ACF.gls . . . 2776 ACF.lme . . . 2777 Alfalfa . . . 2778 allCoef . . . 2779 anova.gls . . . 2780 anova.lme . . . 2782 as.matrix.corStruct . . . 2785 as.matrix.pdMat . . . 2786 as.matrix.reStruct . . . 2786 asOneFormula . . . 2787 Assay . . . 2788 asTable . . . 2789 augPred . . . 2790 balancedGrouped . . . 2791 bdf . . . 2792 BodyWeight . . . 2793 Cefamandole . . . 2794 Coef . . . 2795 coef.corStruct . . . 2795 coef.gnls . . . 2796 coef.lme . . . 2797 coef.lmList . . . 2799

(41)

xl CONTENTS coef.modelStruct . . . 2800 coef.pdMat . . . 2801 coef.reStruct . . . 2802 coef.varFunc . . . 2803 collapse . . . 2804 collapse.groupedData . . . 2805 compareFits . . . 2806 comparePred . . . 2807 corAR1 . . . 2809 corARMA . . . 2810 corCAR1 . . . 2812 corClasses . . . 2813 corCompSymm . . . 2814 corExp . . . 2815 corFactor . . . 2817 corFactor.corStruct . . . 2818 corGaus . . . 2819 corLin . . . 2820 corMatrix . . . 2822 corMatrix.corStruct . . . 2823 corMatrix.pdMat . . . 2824 corMatrix.reStruct . . . 2825 corNatural . . . 2826 corRatio . . . 2827 corSpatial . . . 2828 corSpher . . . 2830 corSymm . . . 2832 Covariate . . . 2833 Covariate.varFunc . . . 2834 Dialyzer . . . 2835 Dim . . . 2835 Dim.corSpatial . . . 2836 Dim.corStruct . . . 2837 Dim.pdMat . . . 2838 Earthquake . . . 2839 ergoStool . . . 2840 Fatigue . . . 2840 fdHess . . . 2841 fitted.glsStruct . . . 2842 fitted.gnlsStruct . . . 2843 fitted.lme . . . 2843 fitted.lmeStruct . . . 2844 fitted.lmList . . . 2845 fitted.nlmeStruct . . . 2846 fixed.effects . . . 2847 fixef.lmList . . . 2848 formula.pdBlocked . . . 2849 formula.pdMat . . . 2850 formula.reStruct . . . 2851 gapply . . . 2851 Gasoline . . . 2853 getCovariate . . . 2853

(42)

CONTENTS xli getCovariate.corStruct . . . 2854 getCovariate.data.frame . . . 2855 getCovariate.varFunc . . . 2856 getCovariateFormula . . . 2857 getData . . . 2857 getData.gls . . . 2858 getData.lme . . . 2859 getData.lmList . . . 2860 getGroups . . . 2860 getGroups.corStruct . . . 2861 getGroups.data.frame . . . 2862 getGroups.gls . . . 2863 getGroups.lme . . . 2864 getGroups.lmList . . . 2865 getGroups.varFunc . . . 2866 getGroupsFormula . . . 2867 getResponse . . . 2868 getResponseFormula . . . 2869 getVarCov . . . 2869 gls . . . 2870 glsControl . . . 2872 glsObject . . . 2874 glsStruct . . . 2875 Glucose . . . 2875 Glucose2 . . . 2876 gnls . . . 2876 gnlsControl . . . 2878 gnlsObject . . . 2880 gnlsStruct . . . 2881 groupedData . . . 2881 gsummary . . . 2884 Gun . . . 2885 IGF . . . 2886 Initialize . . . 2886 Initialize.corStruct . . . 2887 Initialize.glsStruct . . . 2888 Initialize.lmeStruct . . . 2889 Initialize.reStruct . . . 2890 Initialize.varFunc . . . 2891 intervals . . . 2892 intervals.gls . . . 2893 intervals.lme . . . 2894 intervals.lmList . . . 2895 isBalanced . . . 2896 isInitialized . . . 2897 LDEsysMat . . . 2898 lme . . . 2899 lme.groupedData . . . 2901 lme.lmList . . . 2904 lmeControl . . . 2906 lmeObject . . . 2907 lmeStruct . . . 2909

(43)

xlii CONTENTS lmList . . . 2909 lmList.groupedData . . . 2911 logDet . . . 2912 logDet.corStruct . . . 2913 logDet.pdMat . . . 2914 logDet.reStruct . . . 2914 logLik.corStruct . . . 2915 logLik.glsStruct . . . 2916 logLik.gnls . . . 2917 logLik.gnlsStruct . . . 2917 logLik.lme . . . 2918 logLik.lmeStruct . . . 2919 logLik.lmList . . . 2920 logLik.reStruct . . . 2921 logLik.varFunc . . . 2922 Machines . . . 2923 MathAchieve . . . 2923 MathAchSchool . . . 2924 Matrix . . . 2924 Matrix.pdMat . . . 2925 Matrix.reStruct . . . 2926 Meat . . . 2926 Milk . . . 2927 model.matrix.reStruct . . . 2928 Muscle . . . 2929 Names . . . 2929 Names.formula . . . 2930 Names.pdBlocked . . . 2931 Names.pdMat . . . 2932 Names.reStruct . . . 2933 needUpdate . . . 2934 needUpdate.modelStruct . . . 2934 Nitrendipene . . . 2935 nlme . . . 2936 nlme.nlsList . . . 2939 nlmeControl . . . 2941 nlmeObject . . . 2943 nlmeStruct . . . 2944 nlsList . . . 2945 nlsList.selfStart . . . 2946 Oats . . . 2947 Orthodont . . . 2948 Ovary . . . 2949 Oxboys . . . 2949 Oxide . . . 2950 pairs.compareFits . . . 2951 pairs.lme . . . 2952 pairs.lmList . . . 2953 PBG . . . 2954 pdBlocked . . . 2955 pdClasses . . . 2957 pdCompSymm . . . 2958

(44)

CONTENTS xliii pdConstruct . . . 2959 pdConstruct.pdBlocked . . . 2960 pdDiag . . . 2961 pdFactor . . . 2962 pdFactor.reStruct . . . 2963 pdIdent . . . 2964 pdLogChol . . . 2965 pdMat . . . 2967 pdMatrix . . . 2968 pdMatrix.reStruct . . . 2969 pdNatural . . . 2970 pdSymm . . . 2971 Phenobarb . . . 2972 phenoModel . . . 2973 Pixel . . . 2974 plot.ACF . . . 2975 plot.augPred . . . 2976 plot.compareFits . . . 2977 plot.gls . . . 2978 plot.intervals.lmList . . . 2979 plot.lme . . . 2980 plot.lmList . . . 2982 plot.nffGroupedData . . . 2983 plot.nfnGroupedData . . . 2985 plot.nmGroupedData . . . 2986 plot.ranef.lme . . . 2988 plot.ranef.lmList . . . 2990 plot.Variogram . . . 2991 pooledSD . . . 2992 predict.gls . . . 2993 predict.gnls . . . 2994 predict.lme . . . 2995 predict.lmList . . . 2996 predict.nlme . . . 2997 print.summary.pdMat . . . 2998 print.varFunc . . . 2999 qqnorm.gls . . . 3000 qqnorm.lme . . . 3001 Quinidine . . . 3003 quinModel . . . 3004 Rail . . . 3005 random.effects . . . 3005 ranef.lme . . . 3006 ranef.lmList . . . 3008 RatPupWeight . . . 3009 recalc . . . 3010 recalc.corStruct . . . 3011 recalc.modelStruct . . . 3012 recalc.reStruct . . . 3013 recalc.varFunc . . . 3013 Relaxin . . . 3014 Remifentanil . . . 3015

(45)

xliv CONTENTS residuals.gls . . . 3015 residuals.glsStruct . . . 3016 residuals.gnlsStruct . . . 3017 residuals.lme . . . 3018 residuals.lmeStruct . . . 3019 residuals.lmList . . . 3020 residuals.nlmeStruct . . . 3021 reStruct . . . 3022 simulate.lme . . . 3024 solve.pdMat . . . 3025 solve.reStruct . . . 3026 Soybean . . . 3027 splitFormula . . . 3027 Spruce . . . 3028 summary.corStruct . . . 3029 summary.gls . . . 3030 summary.lme . . . 3031 summary.lmList . . . 3032 summary.modelStruct . . . 3033 summary.nlsList . . . 3034 summary.pdMat . . . 3035 summary.varFunc . . . 3036 Tetracycline1 . . . 3037 Tetracycline2 . . . 3038 update.modelStruct . . . 3038 update.varFunc . . . 3039 varClasses . . . 3040 varComb . . . 3041 varConstPower . . . 3041 VarCorr . . . 3043 varExp . . . 3044 varFixed . . . 3045 varFunc . . . 3046 varIdent . . . 3046 Variogram . . . 3048 Variogram.corExp . . . 3049 Variogram.corGaus . . . 3050 Variogram.corLin . . . 3051 Variogram.corRatio . . . 3052 Variogram.corSpatial . . . 3053 Variogram.corSpher . . . 3054 Variogram.default . . . 3055 Variogram.gls . . . 3056 Variogram.lme . . . 3058 varPower . . . 3060 varWeights . . . 3061 varWeights.glsStruct . . . 3062 varWeights.lmeStruct . . . 3063 Wafer . . . 3063 Wheat . . . 3064 Wheat2 . . . 3064 [.pdMat . . . 3065

(46)

CONTENTS xlv

26 The nnet package 3067

class.ind . . . 3067 multinom . . . 3068 nnet . . . 3069 nnetHess . . . 3072 predict.nnet . . . 3073 which.is.max . . . 3074

27 The rpart package 3075

car.test.frame . . . 3075 car90 . . . 3076 cu.summary . . . 3078 kyphosis . . . 3079 labels.rpart . . . 3079 meanvar.rpart . . . 3080 na.rpart . . . 3081 path.rpart . . . 3082 plot.rpart . . . 3083 plotcp . . . 3084 post.rpart . . . 3085 predict.rpart . . . 3086 print.rpart . . . 3087 printcp . . . 3089 prune.rpart . . . 3090 residuals.rpart . . . 3090 rpart . . . 3091 rpart.control . . . 3093 rpart.exp . . . 3094 rpart.object . . . 3095 rsq.rpart . . . 3096 snip.rpart . . . 3097 solder . . . 3098 stagec . . . 3099 summary.rpart . . . 3100 text.rpart . . . 3101 xpred.rpart . . . 3102

28 The spatial package 3105

anova.trls . . . 3105 correlogram . . . 3106 expcov . . . 3107 Kaver . . . 3108 Kenvl . . . 3109 Kfn . . . 3110 ppgetregion . . . 3111 ppinit . . . 3111 pplik . . . 3112 ppregion . . . 3113 predict.trls . . . 3113 prmat . . . 3114 Psim . . . 3115 semat . . . 3116 SSI . . . 3117

(47)

xlvi CONTENTS Strauss . . . 3118 surf.gls . . . 3119 surf.ls . . . 3120 trls.influence . . . 3121 trmat . . . 3122 variogram . . . 3123

29 The survival package 3125

aareg . . . 3125 agreg.fit . . . 3128 aml . . . 3129 anova.coxph . . . 3129 attrassign . . . 3130 basehaz . . . 3132 bladder . . . 3132 cch . . . 3134 cgd . . . 3136 cgd0 . . . 3137 clogit . . . 3138 cluster . . . 3140 colon . . . 3141 cox.zph . . . 3142 coxph . . . 3143 coxph.control . . . 3146 coxph.detail . . . 3147 coxph.object . . . 3149 coxph.wtest . . . 3150 dsurvreg . . . 3150 flchain . . . 3152 frailty . . . 3153 heart . . . 3155 is.ratetable . . . 3156 kidney . . . 3157 lines.survfit . . . 3158 logan . . . 3159 lung . . . 3160 mgus . . . 3161 mgus2 . . . 3162 model.frame.coxph . . . 3163 model.matrix.coxph . . . 3164 neardate . . . 3165 nwtco . . . 3166 ovarian . . . 3167 pbc . . . 3168 pbcseq . . . 3169 plot.aareg . . . 3170 plot.cox.zph . . . 3171 plot.survfit . . . 3172 predict.coxph . . . 3174 predict.survreg . . . 3176 print.aareg . . . 3177 print.summary.coxph . . . 3178 print.summary.survexp . . . 3178

(48)

CONTENTS xlvii print.summary.survfit . . . 3179 print.survfit . . . 3180 pspline . . . 3181 pyears . . . 3183 quantile.survfit . . . 3185 ratetable . . . 3187 ratetableDate . . . 3188 ratetables . . . 3188 rats . . . 3189 rats2 . . . 3190 residuals.coxph . . . 3191 residuals.survreg . . . 3192 ridge . . . 3193 stanford2 . . . 3194 strata . . . 3195 summary.aareg . . . 3196 summary.coxph . . . 3197 summary.survexp . . . 3198 summary.survfit . . . 3199 Surv . . . 3201 survConcordance . . . 3202 survdiff . . . 3204 survexp . . . 3206 survexp.fit . . . 3208 survfit . . . 3210 survfit.coxph . . . 3211 survfit.formula . . . 3214 survfit.object . . . 3217 survfitcoxph.fit . . . 3218 survobrien . . . 3220 survreg . . . 3221 survreg.control . . . 3223 survreg.distributions . . . 3223 survreg.object . . . 3225 survregDtest . . . 3226 survSplit . . . 3227 tcut . . . 3228 tmerge . . . 3229 tobin . . . 3231 transplant . . . 3232 untangle.specials . . . 3233 uspop2 . . . 3233 veteran . . . 3234 Index 3237

(49)
(50)

Part I

(51)
(52)

Chapter 1

The base package

base-package The R Base Package

Description

Base R functions Details

This package contains the basic functions which let R function as a language: arithmetic, in-put/output, basic programming support, etc. Its contents are available through inheritance from any environment.

For a complete list of functions, uselibrary(help = "base").

.bincode Bin a Numeric Vector

Description

Bin a numeric vector and return integer codes for the binning. Usage

.bincode(x, breaks, right = TRUE, include.lowest = FALSE) Arguments

x a numeric vector which is to be converted to integer codes by binning. breaks a numeric vector of two or more cut points, sorted in increasing order.

right logical, indicating if the intervals should be closed on the right (and open on the left) or vice versa.

include.lowest logical, indicating if an ‘x[i]’ equal to the lowest (or highest, for right = FALSE) ‘breaks’ value should be included in the first (or last) bin.

(53)

4 .Device Details

This is a ‘barebones’ version ofcut.default(labels = FALSE) intended for use in other functions which have checked the arguments passed. (Note the different order of the arguments they have in common.)

Unlikecut, thebreaks do not need to be unique. An input can only fall into a zero-length interval if it is closed at both ends, so only ifinclude.lowest = TRUE and it is the first (or last for right = FALSE) interval.

Value

An integer vector of the same length asx indicating which bin each element falls into (the leftmost bin being bin1). NaN and NA elements of x are mapped to NA codes, as are values outside range of breaks.

See Also

cut,tabulate Examples

## An example with non-unique breaks: x <- c(0, 0.01, 0.5, 0.99, 1)

b <- c(0, 0, 1, 1) .bincode(x, b, TRUE) .bincode(x, b, FALSE) .bincode(x, b, TRUE, TRUE) .bincode(x, b, FALSE, TRUE)

.Device Lists of Open/Active Graphics Devices

Description

A pairlist of the names of open graphics devices is stored in.Devices. The name of the active device (seedev.cur) is stored in.Device. Both are symbols and so appear in the base namespace.

Value

.Device is a length-one character vector.

.Devices is apairlistof length-one character vectors. The first entry is always"null device", and there are as many entries as the maximal number of graphics devices which have been simul-taneously active. If a device has been removed, its entry will be"" until the device number is reused.

(54)

.Machine 5

.Machine Numerical Characteristics of the Machine

Description

.Machine is a variable holding information on the numerical characteristics of the machine R is running on, such as the largest double or integer and the machine’s precision.

Usage .Machine Details

The algorithm is based on Cody’s (1988) subroutine MACHAR. As all current implementations of R use 32-bit integers and use IEC 60559 floating-point (double precision) arithmetic, all but three of the last four values are the same for almost all R builds.

Note that on most platforms smaller positive values than.Machine$double.xmin can occur. On a typical R platform the smallest positive double is about5e-324.

Value

A list with components

double.eps the smallest positive floating-point numberx such that 1 + x != 1. It equals double.base ^ ulp.digits if either double.base is 2 or double.rounding is 0; otherwise, it is(double.base ^ double.ulp.digits) / 2. Normally 2.220446e-16.

double.neg.eps a small positive floating-point number x such that 1 - x != 1. It equals double.base ^ double.neg.ulp.digits if double.base is 2 or double.rounding is 0; otherwise, it is (double.base ^ double.neg.ulp.digits) / 2. Normally 1.110223e-16. Asdouble.neg.ulp.digits is bounded below by -(double.digits + 3), double.neg.eps may not be the smallest number that can alter 1 by subtraction. double.xmin the smallest non-zero normalized floating-point number, a power of the radix,

i.e.,double.base ^ double.min.exp. Normally 2.225074e-308.

double.xmax the largest normalized floating-point number. Typically, it is equal to (1 - double.neg.eps) * double.base ^ double.max.exp, but on some machines it is only the second or third largest such number, being too small by 1 or 2 units in the last digit of the significand. Normally1.797693e+308. Note that larger unnormalized numbers can occur.

double.base the radix for the floating-point representation: normally2.

double.digits the number of base digits in the floating-point significand: normally 53. double.rounding

the rounding action, one of 0 if floating-point addition chops;

1 if floating-point addition rounds, but not in the IEEE style; 2 if floating-point addition rounds in the IEEE style;

(55)

6 .Machine 4 if floating-point addition rounds, but not in the IEEE style, and there is partial underflow;

5 if floating-point addition rounds in the IEEE style, and there is partial under-flow.

Normally5.

double.guard the number of guard digits for multiplication with truncating arithmetic. It is 1 if floating-point arithmetic truncates and more than double digits base-double.base digits participate in the post-normalization shift of the floating-point significand in multiplication, and 0 otherwise.

Normally0. double.ulp.digits

the largest negative integeri such that 1 + double.base ^ i != 1, except that it is bounded below by-(double.digits + 3). Normally -52.

double.neg.ulp.digits

the largest negative integeri such that 1 - double.base ^ i != 1, except that it is bounded below by-(double.digits + 3). Normally -53.

double.exponent

the number of bits (decimal places ifdouble.base is 10) reserved for the repre-sentation of the exponent (including the bias or sign) of a floating-point number. Normally11.

double.min.exp the largest in magnitude negative integer i such that double.base ^ i is posi-tive and normalized. Normally-1022.

double.max.exp the smallest positive power of double.base that overflows. Normally 1024. integer.max the largest integer which can be represented. Always 231 − 1 = 2147483647. sizeof.long the number of bytes in a Clong type: 4 or 8 (most 64-bit systems, but not

Windows). sizeof.longlong

the number of bytes in a Clong long type. Will be zero if there is no such type, otherwise usually8.

sizeof.longdouble

the number of bytes in a Clong double type. Will be zero if there is no such type (or its use was disabled when R was built), otherwise possibly12 (most 32-bit builds) or16 (most 64-bit builds).

sizeof.pointer the number of bytes in a C SEXP type. Will be 4 on 32-bit builds and 8 on 64-bit builds of R.

Note

sizeof.longdouble only tells you the amount of storage allocated for a long double (which are normally used internally by R for accumulators in e.g.sum, and can be read byreadBin). Often what is stored is the 80-bit extended double type of IEC 60559, padded to the double alignment used on the platform — this seems to be the case for the common R platforms using ix86 and x86_64 chips.

Source

Uses a C translation of Fortran code in the reference, modified by the R Core Team to defeat over-optimization in recent compilers.

(56)

.Platform 7 References

Cody, W. J. (1988) MACHAR: A subroutine to dynamically determine machine parameters. Trans-actions on Mathematical Software, 14, 4, 303–311.

See Also

.Platformfor details of the platform. Examples

.Machine

## or for a neat printout

noquote(unlist(format(.Machine)))

.Platform Platform Specific Variables

Description

.Platform is a list with some details of the platform under which R was built. This provides means to write OS-portable R code.

Usage

.Platform Value

A list with at least the following components:

OS.type character string, giving the Operating System (family) of the computer. One of "unix" or "windows".

file.sep character string, giving the file separator used on your platform: "/" on both Unix-alikes and on Windows (but not on the former port to Classic Mac OS). dynlib.ext character string, giving the file name extension of dynamically loadable

libraries, e.g.,".dll" on Windows and ".so" or ".sl" on Unix-alikes. (Note for OS X users: these are shared objects as loaded bydyn.loadand not dylibs: seedyn.load.)

GUI character string, giving the type of GUI in use, or"unknown" if no GUI can be assumed. Possible values are for Unix-alikes the values given via the ‘-g’ command-line flag ("X11", "Tk"), "AQUA" (running under R.app on OS X), "Rgui" and "RTerm" (Windows) and perhaps others under alternative front-ends or embedded R.

endian character string,"big" or "little", giving the endianness of the processor in use. This is relevant when it is necessary to know the order to read/write bytes of e.g. an integer or double from/to aconnection: seereadBin.

pkgType character string, the preferred setting for options("pkgType"). Values "source", "mac.binary", "mac.binary.mavericks" and "win.binary" are currently in use.

(57)

8 abbreviate path.sep character string, giving the path separator, used on your platform, e.g., ":" on Unix-alikes and";" on Windows. Used to separate paths in environment variables such asPATH and TEXINPUTS.

r_arch character string, possibly "". The name of an architecture-specific directory used in this build of R.

AQUA

.Platform$GUI is set to "AQUA" under the OS X GUI, R.app. This has a number of consequences: • theDISPLAY environment variable is set to ":0" if unset.

• appends ‘/usr/local/bin’ to the PATH environment variable. • the default graphics device is set toquartz.

• selects native (rather than Tk) widgets for thegraphics = TRUE options ofmenuand

select.list.

• HTML help is displayed in the internal browser.

• The spreadsheet-like data editor/viewer uses a Quartz version rather than the X11 one. See Also

R.versionandSys.infogive more details about the OS. In particular,R.version$platform is the canonical name of the platform under which R was compiled.

.Machinefor details of the arithmetic used, and system for invoking platform-specific system commands.

Examples

## Note: this can be done in a system-independent way ## by file.info()$isdir: see utils::file_test,

## and there is a built-in dir.exists() as from R 3.2.0. if(.Platform$OS.type == "unix") {

system.test <- function(...) system(paste("test", ...)) == 0L dir.exists2 <- function(dir)

sapply(dir, function(d) system.test("-d", d)) dir.exists2(c(R.home(), "/tmp", "~", "/NO")) # > T T T F }

abbreviate Abbreviate Strings

Description

Abbreviate strings to at leastminlength characters, such that they remain unique (if they were), unlessstrict = TRUE.

Usage

abbreviate(names.arg, minlength = 4, use.classes = TRUE, dot = FALSE, strict = FALSE,

(58)

abbreviate 9 Arguments

names.arg a character vector of names to be abbreviated, or an object to be coerced to a character vector byas.character.

minlength the minimum length of the abbreviations. use.classes logical (currently ignored by R).

dot logical: should a dot (".") be appended?

strict logical: should minlength be observed strictly? Note that setting strict = TRUE may return non-unique strings.

method a string specifying the method used with default"left.kept", see ‘Details’ below.

Details

The default algorithm (method = "left.kept") used is similar to that of S. For a single string it works as follows. First all spaces at the beginning of the string are stripped. Then (if necessary) any other spaces are stripped. Next, lower case vowels are removed (starting at the right) followed by lower case consonants. Finally if the abbreviation is still longer thanminlength upper case letters are stripped.

Characters are always stripped from the end of the word first. If an element ofnames.arg contains more than one word (words are separated by space) then at least one letter from each word will be retained.

Missing (NA) values are unaltered.

Ifuse.classes is FALSE then the only distinction is to be between letters and space. This has NOT been implemented.

Value

A character vector containing abbreviations for the strings in its first argument. Duplicates in the original names.arg will be given identical abbreviations. If any non-duplicated elements have the sameminlength abbreviations then, if method = "both.sides" the basic internal abbreviate() algorithm is applied to the characterwise reversed strings; if there are still dupli-cated abbreviations and ifstrict = FALSE as by default, minlength is incremented by one and new abbreviations are found for those elements only. This process is repeated until all unique ele-ments ofnames.arg have unique abbreviations.

The character version ofnames.arg is attached to the returned value as a names argument: no other attributes are retained.

Warning

This is really only suitable for English, and does not work correctly with non-ASCII characters in multibyte locales. It will warn if used with non-ASCII characters (and required to reduce the length).

See Also

(59)

10 agrep Examples

x <- c("abcd", "efgh", "abce") abbreviate(x, 2)

abbreviate(x, 2, strict = TRUE) # >> 1st and 3rd are == "ab" (st.abb <- abbreviate(state.name, 2))

table(nchar(st.abb)) # out of 50, 3 need 4 letters : as <- abbreviate(state.name, 3, strict = TRUE) as[which(as == "Mss")]

## method="both.sides" helps: no 4-letters, and only 4 3-letters: st.ab2 <- abbreviate(state.name, 2, method = "both")

table(nchar(st.ab2)) ## Compare the two methods: cbind(st.abb, st.ab2)

agrep Approximate String Matching (Fuzzy Matching)

Description

Searches for approximate matches topattern (the first argument) within each element of the string x (the second argument) using the generalized Levenshtein edit distance (the minimal possibly weighted number of insertions, deletions and substitutions needed to transform one string into an-other).

Usage

agrep(pattern, x, max.distance = 0.1, costs = NULL, ignore.case = FALSE, value = FALSE, fixed = TRUE, useBytes = FALSE)

agrepl(pattern, x, max.distance = 0.1, costs = NULL,

ignore.case = FALSE, fixed = TRUE, useBytes = FALSE) Arguments

pattern a non-empty character string or a character string containing a regular expression (forfixed = FALSE) to be matched. Coerced byas.characterto a string if possible.

x character vector where matches are sought. Coerced by as.characterto a character vector if possible.

max.distance Maximum distance allowed for a match. Expressed either as integer, or as a fraction of the pattern length times the maximal transformation cost (will be replaced by the smallest integer not less than the corresponding fraction), or a list with possible components

cost: maximum number/fraction of match cost (generalized Levenshtein dis-tance)

all: maximal number/fraction of all transformations (insertions, deletions and substitutions)

(60)

agrep 11 insertions: maximum number/fraction of insertions

deletions: maximum number/fraction of deletions

substitutions: maximum number/fraction of substitutions

Ifcost is not given, all defaults to 10%, and the other transformation number bounds default toall. The component names can be abbreviated.

costs a numeric vector or list with names partially matching ‘insertions’, ‘deletions’ and ‘substitutions’ giving the respective costs for computing the generalized Levenshtein distance, or NULL (default) indicating using unit cost for all three possible transformations. Coerced to integer viaas.integer if possible.

ignore.case if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

value ifFALSE, a vector containing the (integer) indices of the matches determined is returned and ifTRUE, a vector containing the matching elements themselves is returned.

fixed logical. IfTRUE (default), the pattern is matched literally (as is). Otherwise, it is matched as a regular expression.

useBytes logical. in a multibyte locale, should the comparison be character-by-character (the default) or byte-by-byte.

Details

The Levenshtein edit distance is used as measure of approximateness: it is the (possibly cost-weighted) total number of insertions, deletions and substitutions required to transform one string into another.

This usestre by Ville Laurikari (http://laurikari.net/tre/), which supports MBCS character matching.

The main effect ofuseBytes is to avoid errors/warnings about invalid inputs and spurious matches in multibyte locales. It inhibits the conversion of inputs with marked encodings, and is forced if any input is found which is marked as"bytes" (seeEncoding).

Value

agrep returns a vector giving the indices of the elements that yielded a match, or, if value is TRUE, the matched elements (after coercion, preserving names but no other attributes).

agrepl returns a logical vector. Note

Since someone who read the description carelessly even filed a bug report on it, do note that this matches substrings of each element ofx (just asgrepdoes) and not whole elements. See alsoadist in package utils, which optionally returns the offsets of the matched substrings.

Author(s)

Original version in R < 2.10.0 by David Meyer. Current version by Brian Ripley and Kurt Hornik. See Also

Referências

Documentos relacionados

The Kwame Nkrumah Ideological Institute (1961-1966) was an ideological school for both the Ghanaian ruling party (Convention People’s Party) and the African freedom fighters

Nada melhor que as imagens e símbolos das obras de arte, mitos e religiões - além, é claro, da experiência direta de estar apaixonado para expressar o forte componente irracional

The efficacy of 28 individual or blended disinfectants against avian Salmonella enterica serovar Enteritidis and Escherichia coli strains was determined.. An in vitro test

The data in this category evidence that there are elements of the order of the conditions and of the organization of the work, which are linked and which determine the exposure of

There are diverse elements determining a behavioral pattern for the functioning of the academic publication practices of the community of researchers in the discipline, which are

C’est l’effet d’étrangeté que cette superposition provoque — que certains artistes contemporains de l’aire performative prétendent opérer, aux côtés de tant

Esses modelos coexistem com imagens mais dicotómicas e unidimensionais – como as do “pai tradicional” e do “novo pai”, por exemplo – e são indicadores de que nas

After identifying four elements that met these criteria—uc248, uc329, uc467, and uc482—the researchers engineered “knockout” strains of mice that lacked one of the four