ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 06.04.2021

Просмотров: 865

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
background image

CONTENTS

CONTENTS

8.3.21 one-dimensional arrays

. . . . . . . . . . . . . . . . . . . . 110

8.3.22 by is for data frames

. . . . . . . . . . . . . . . . . . . . . 110

8.3.23 stray backquote

. . . . . . . . . . . . . . . . . . . . . . . . 111

8.3.24 array dimension calculation

. . . . . . . . . . . . . . . . . 111

8.3.25 replacing pieces of a matrix

. . . . . . . . . . . . . . . . . 111

8.3.26 reserved words

. . . . . . . . . . . . . . . . . . . . . . . . 112

8.3.27 return is a function

. . . . . . . . . . . . . . . . . . . . . . 112

8.3.28 return is a function (still)

. . . . . . . . . . . . . . . . . . 113

8.3.29 BATCH failure

. . . . . . . . . . . . . . . . . . . . . . . . 113

8.3.30 corrupted .RData

. . . . . . . . . . . . . . . . . . . . . . . 113

8.3.31 syntax errors

. . . . . . . . . . . . . . . . . . . . . . . . . 113

8.3.32 general confusion

. . . . . . . . . . . . . . . . . . . . . . . 114

9 Unhelpfully Seeking Help

115

9.1

Read the documentation

. . . . . . . . . . . . . . . . . . . . . . . 115

9.2

Check the FAQ

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

9.3

Update

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

9.4

Read the posting guide

. . . . . . . . . . . . . . . . . . . . . . . . 117

9.5

Select the best list

. . . . . . . . . . . . . . . . . . . . . . . . . . 117

9.6

Use a descriptive subject line

. . . . . . . . . . . . . . . . . . . . 118

9.7

Clearly state your question

. . . . . . . . . . . . . . . . . . . . . 118

9.8

Give a minimal example

. . . . . . . . . . . . . . . . . . . . . . . 120

9.9

Wait

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Index

123

5


background image

List of Figures

2.1

The giants by Sandro Botticelli.

. . . . . . . . . . . . . . . . . . .

14

3.1

The hypocrites by Sandro Botticelli.

. . . . . . . . . . . . . . . .

19

4.1

The panderers and seducers and the flatterers by Sandro Botticelli.

25

5.1

Stack of environments through time.

. . . . . . . . . . . . . . . .

32

6.1

The sowers of discord by Sandro Botticelli.

. . . . . . . . . . . .

36

7.1

The Simoniacs by Sandro Botticelli.

. . . . . . . . . . . . . . . .

41

8.1

The falsifiers: alchemists by Sandro Botticelli.

. . . . . . . . . . .

47

8.2

The treacherous to kin and the treacherous to country by Sandro
Botticelli.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

81

8.3

The treacherous to country and the treacherous to guests and
hosts by Sandro Botticelli.

. . . . . . . . . . . . . . . . . . . . . . 103

9.1

The thieves by Sandro Botticelli.

. . . . . . . . . . . . . . . . . . 116

9.2

The thieves by Sandro Botticelli.

. . . . . . . . . . . . . . . . . . 119

6


background image

List of Tables

2.1

Time in seconds of methods to create a sequence.

. . . . . . . . .

12

3.1

Summary of subscripting with

8

[

8

.

. . . . . . . . . . . . . . . . .

20

4.1

The apply family of functions.

. . . . . . . . . . . . . . . . . . . .

24

5.1

Simple objects.

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

5.2

Some not so simple objects.

. . . . . . . . . . . . . . . . . . . . .

29

8.1

A few of the most important backslashed characters.

. . . . . . .

59

8.2

Functions to do with quotes.

. . . . . . . . . . . . . . . . . . . .

61

7


background image

Preface

Abstract:

If you are using R and you think you’re in hell, this is a map for

you.

wandered

through

http://www.r-project.org

.

To state the good I found there, I’ll also say what else I saw.

Having abandoned the true way, I fell into a deep sleep and awoke in a deep

dark wood. I set out to escape the wood, but my path was blocked by a lion.
As I fled to lower ground, a figure appeared before me. “Have mercy on me,
whatever you are,” I cried, “whether shade or living human.”

“Not a man, though once I was. My parents were from Lombardy. I was

born

sub Julio

and lived in Rome in an age of false and lying gods.”

“Are you Virgil, the fountainhead of such a volume?”
“I think it wise you follow me. I’ll lead you through an eternal place where

you shall hear despairing cries and see those ancient souls in pain as they grieve
their second death.”

After a journey, we arrived at an archway. Inscribed on it: “Through me

the way into the suffering city, through me the way among the lost.” Through
the archway we went.

Now sighing and wails resounded through the starless air, so that I too

began weeping. Unfamiliar tongues, horrendous accents, cries of rage—all of
these whirled in that dark and timeless air.

8


background image

Circle 1

Falling into the Floating
Point Trap

Once we had crossed the Acheron, we arrived in the first Circle, home of the
virtuous pagans. These are people who live in ignorance of the Floating Point
Gods. These pagans expect

.1 == .3 / 3

to be true.

The virtuous pagans will also expect

seq(0, 1, by=.1) == .3

to have exactly one value that is true.

But

you

should not expect something like:

unique(c(.3, .4 - .1, .5 - .2, .6 - .3, .7 - .4))

to have length one.

I wrote my first program in the late stone age. The task was to program

the quadratic equation. Late stone age means the medium of expression was
punchcards. There is no backspace on a punchcard machine—once the holes
are there, there’s no filling them back in again. So a typo at the end of a line
means that you have to throw the card out and start the line all over again. A
procedure with which I became all too familiar.

Joy ensued at the end of the long ordeal of acquiring a pack of properly

punched cards. Short-lived joy. The next step was to put the stack of cards
into an in-basket monitored by the computer operator. Some hours later the
(large) paper output from the job would be in a pigeonhole. There was of course
an error in the program. After another struggle with the punchcard machine
(relatively brief this time), the card deck was back in the in-basket.

9