R software

Páginas: 40 (9860 palavras) Publicado: 5 de junho de 2011
The R Inferno
Patrick Burns1 30th April 2011

1 This document resides in the tutorial section of http://www.burns-stat.com. More elementary material on R may also be found there. S+ is a registered trademark of TIBCO Software Inc. The author thanks D. Alighieri for useful comments.

Contents
Contents List of Figures List of Tables 1 Falling into the Floating Point Trap 2 Growing Objects 16 7 9 12

3 Failing to Vectorize 17 3.1 Subscripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.2 Vectorized if . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3 Vectorization impossible . . . . . . . . . . . . . . . . . . . . . . . 22 4 Over-Vectorizing 5 Not 5.1 5.2 5.3 24

Writing Functions 27 Abstraction . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . 27 Simplicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 35 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 38 39 39 40 40 40 41 42 42

6 Doing Global Assignments 7 Tripping on Object Orientation 7.1 S3 methods . . . . . . . . . . . 7.1.1 generic functions . . . . 7.1.2 methods . . . . . . . . . 7.1.3 inheritance . . . . . . . 7.2 S4 methods . . . . . . . . . . . 7.2.1 multiple dispatch .. . . 7.2.2 S4 structure . . . . . . . 7.2.3 discussion . . . . . . . . 7.3 Namespaces . . . . . . . . . . .

1

CONTENTS 8 Believing It Does as Intended 8.1 Ghosts . . . . . . . . . . . . . . . . . . . . . . 8.1.1 differences with S+ . . . . . . . . . . . 8.1.2 package functionality . . . . . . . . . . 8.1.3 precedence . . . . . . . . . . . . . . . 8.1.4 equality of missing values . . . . .. . 8.1.5 testing NULL . . . . . . . . . . . . . . 8.1.6 membership . . . . . . . . . . . . . . . 8.1.7 multiple tests . . . . . . . . . . . . . . 8.1.8 coercion . . . . . . . . . . . . . . . . . 8.1.9 comparison under coercion . . . . . . 8.1.10 parentheses in the right places . . . . 8.1.11 excluding named items . . . . . . . . . 8.1.12 excluding missing values . . . . . . . . 8.1.13 negativenothing is something . . . . . 8.1.14 but zero can be nothing . . . . . . . . 8.1.15 something plus nothing is nothing . . 8.1.16 sum of nothing is zero . . . . . . . . . 8.1.17 the methods shuffle . . . . . . . . . . . 8.1.18 first match only . . . . . . . . . . . . . 8.1.19 first match only (reprise) . . . . . . . 8.1.20 partial matching can partially confuse 8.1.21 no partial match assignments . . .. . 8.1.22 cat versus print . . . . . . . . . . . . . 8.1.23 backslashes . . . . . . . . . . . . . . . 8.1.24 internationalization . . . . . . . . . . . 8.1.25 paths in Windows . . . . . . . . . . . 8.1.26 quotes . . . . . . . . . . . . . . . . . . 8.1.27 backquotes . . . . . . . . . . . . . . . 8.1.28 disappearing attributes . . . . . . . . 8.1.29 disappearing attributes (reprise) . . . 8.1.30when space matters . . . . . . . . . . 8.1.31 multiple comparisons . . . . . . . . . . 8.1.32 name masking . . . . . . . . . . . . . 8.1.33 more sorting than sort . . . . . . . . . 8.1.34 sort.list not for lists . . . . . . . . . . 8.1.35 search list shuffle . . . . . . . . . . . . 8.1.36 source versus attach or load . . . . . . 8.1.37 string not the name . . . . . . . . . . 8.1.38 get a component . .. . . . . . . . . . 8.1.39 string not the name (encore) . . . . . 8.1.40 string not the name (yet again) . . . . 8.1.41 string not the name (still) . . . . . . . 8.1.42 name not the argument . . . . . . . . 8.1.43 unexpected else . . . . . . . . . . . . . 8.1.44 dropping dimensions . . . . . . . . . . 2

CONTENTS 44 46 46 46 47 48 48 49 49 50 51 51 51 52 52 53 53 54 54 55 55 56 58 58 59 59 60...
Ler documento completo

Por favor, assinar para o acesso.

Estes textos também podem ser interessantes

  • R
  • R
  • O Que E R
  • R
  • R
  • R
  • Bibliografia De R R Soares
  • Nr12 r r 15

Seja um membro do Trabalhos Feitos

CADASTRE-SE AGORA!