Free Essay

R Language

In:

Submitted By SVIOLALALA
Words 3308
Pages 14
PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

R
R :
1.7

R Development Core Team June 10, 2006

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Contents
1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 3 3.1 3.2 3.3 3.4 4 4.1 4.2 4.3 5 5.1 5.2 5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tapply() ragged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (index vector); . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R R R R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 7 7 7 8 9 10 10 11 11 11 12 12 12 13 14 14 14 15

R

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CONTENTS 5.4 5.5 5.6 5.7 array() . . . 5.4.1 . . . 5.7.1 5.7.2 5.7.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . QR . . . . . . . . . . . . . cbind() rbind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ii 16 16 17 17 18 18 18 19 19 19 19 19 20 21 21 22 22 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 32 35 35 35 35 35 37 37 38 38 39 39 39

5.8 5.9 5.10 5.11 5.12 6 6.1 6.2 6.2.1 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 7 7.1 7.2 7.3 7.4 8 8.1 8.2 8.3 9 9.1 9.2 9.2.1 9.2.2 10 10.1 10.2 10.3 10.4 10.5 10.6 R—

c()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . attach() detach() . . . . . . . . . .

read.table() . . scan() . . . . . . . 7.3.1 R . . . . . .

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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . if . . . . . . . . . . . for repeat while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . ’...’ . . . . . . . . . . . . . . . . . .

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CONTENTS 10.6.1 10.6.2 10.6.3 . 10.7 (scope) . . . . . . . . 10.8 . . . . . . . . . 10.9 11 R 11.1 11.1.1 11.2 11.3 11.4 11.4.1 11.5 11.6 11.6.1 11.6.2 11.7 11.7.1 11.7.2 11.8 12 12.1 12.1.1 12.1.2 12.1.3 12.1.4 12.2 12.2.1 12.2.2 12.3 12.4 12.4.1 12.4.2 12.5 12.5.1 12.5.2 12.5.3 12.5.4 12.6 12.6.1 12.6.2 12.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hershey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (Permanent changes): . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (Figure margins) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PostScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . plot() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . par() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (Efficiency factors) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

iii 39 40 41 41 43 44 45 45 48 48 48 49 49 50 50 51 51 53 53 54 55 56 56 56 57 58 58 59 61 61 61 62 62 63 63 63 64 65 65 67 67 67 68

. . . . . . . . (contrasts) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (ANOVA tables) . . . . . . . . . . . . . . . . . . . . . . . . (families) . . . . . . . . . glm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 1

1.1
R • • • • •

R

S ” ” environment R R

R

R

R

1.2
R Rick Becker,John Chambers AllanWilks Bell S-Plus S John Chambers R , The New S Language: A Programming Environment for Data Analysis and Graphics Richard A. Becker, John M. Chambers and Allan R. Wilks 1991 S (S version 3) Statistical Models in S edited by John M. Chambers and Trevor J. Hastie S-Plus R R S S

1

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 1.

2

1.3

R
R R R http://cran.r-project.org R

8 CRAN R S SAS R SPSS

S R R

1.4
R

R
R R X window UNIX Windows R

1.5
R

R
>, UNIX shell 1. work. $ mkdir work $ cd work $ UNIX . R , UNIX shell R

2. 3. 4.

R $ R R R > q() R ) R R $ cd work $ R 1. work R yes,no cancel( R

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 1. 2. R Windows R q() R ” ” R

3

1.6
R

1.7
UNIX man solve >help(solve) >?solve if,for > help("[[") ”It’s important” HTML > help.start() Web (UNIX netscape UNIX ’Search Engine and Keywords’ help.search ?help.search > example(topic) Windows R > ?help function R

) HTML R

1.8

R
R R R ) . ***note 1*** A a (

UNIX ( locale )

(;)

( { }) (#)

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 1. R + R

4

1.9
UNIX Windows R

( readline R

UNIX

) Emacs ( ESS Emacs Speaks Statistics) R Emacs

1.10 work R > source("commands.R") Windows Source File > sink("record.lis") > sink() commands.R

sink record.lis

1.11
R R ( ( > objects() ls() ) workspace rm > rm(x, y, z, ink, junk, temp, foo, bar) R R R R x y R .RData workspace ) R

R

***Note3***

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 2

2.1
R R (10.4, 5.6, 3.1, 6.4 21.7) > x assign("x", c(10.4, 5.6, 3.1, 6.4, 21.7)) ¡assign()

> c(10.4, 5.6, 3.1, 6.4, 21.7) -> x

> 1/x ( > y v s3 s3 c(-5.0, -4.8, -4.6, ..., 4.6, 4.8, 5.0) > s4 s5 temp 13 temp x =, c1 c2 c1 & c2 (”or”) !c1 c1 FALSE

==

TRUE FALSE != (”and”) c1 | c2 1

0 TRUE

2.5
” NA is.na(x) x TRUE FALSE > z Inf - Inf NaN TRUE

is.nan(xx)

is.na(xx) NA NaN NaN TRUE

2.6
R e.g. "x-values" "New iteration results" (’) (”) ( backslash \\ \". \n, , c()

) R C \\, ” \t, tab \b, paste()

sep=string > labs y (x+1)[(!is.na(x)) & x>0] -> z

x[6] > x[1:10] x 10 ( x

x 10) 16 "x", "y", "y", "x" 4

> c("x","y")[rep(c(1,2,2,1), times=4)]

3. > y fruit names(fruit) lunch x[is.na(x)] y[y < 0] y z digits d e e[3] alpha attr(z,"dim") winter > unclass(winter) winter

sec10.9

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 4

1

R

4.1
30 > state statef statef [1] tas sa qld nsw nsw nt wa wa qld vic nsw vic qld qld sa [16] tas sa nt wa vic qld nsw nsw wa sa act nsw vic vic act Levels: act nsw nt qld sa tas vic wa levels()

4.2
> incomes incmeans stderr incster incster act nsw nt qld sa tas vic wa 1.5 4.3102 4.5 4.1061 2.7386 0.5 5.244 2.6575 95% tapply() t tapply() length() qt()

ragged array

4.3 ordered() o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 5

5.1
R 2 1 dim z 1500 > dim(z) x x [,1] [,2] [,3] [,4] [,5] [1,] 1 5 9 13 17 [2,] 2 6 10 14 18 [3,] 3 7 11 15 19 [4,] 4 8 12 16 20 > i i [,1] [,2] [1,] 1 3 [2,] 2 2 [3,] 3 1 > x[i] [1] 9 6 3 > x[i] x [,1] [,2] [,3] [,4] [,5] [1,] 1 5 0 13 17 [2,] 2 0 10 14 18 [3,] 0 7 11 15 19 [4,] 4 8 12 16 20 > blocks(b levels) (v levels) n plot varieties

> Xb Xv > > > > ib eigen(Sm)

Sm

5.8
1

5.9 lsfit() > ans > > > X qr() Xplus search() [1] ".GlobalEnv" "Autoloads" "package:base" .GlobalEnv lentils workspace
1

> search() [1] ".GlobalEnv" "lentils" "Autoloads" "package:base" > ls(2) [1] "u" "v" "w" ls objects

> detach("lentils") > search() [1] ".GlobalEnv" "Autoloads" "package:base"

1

autoload

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 7

R R Perl R read.table() R R data Import/Export scan()
1

R

7.1
• •

read.table()

01 02 03 04 05 ...

Price 52.00 54.75 57.50 57.50 59.75

Floor 111.0 128.0 101.0 131.0 93.0

Area 830 710 1000 690 900

Rooms 5 5 5 6 5

Age 6.2 7.5 4.2 8.8 1.9

Cent.heat no no no no yes

Cent.heat read.table()
1

Unix

Sed

Awk

25

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 7. > HousePrice HousePrice inp label

## 2-tailed 2*pt(-2.43, ## upper 1% qf(0.99, 2,

8.2 summary fivenum stem ”stem and leaf” plot

> data(faithful) > attach(faithful) > summary(eruptions) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.600 2.163 4.000 3.488 4.454 5.100 > fivenum(eruptions) [1] 1.6000 2.1585 4.0000 4.4585 5.1000 > stem(eruptions) The decimal point is 1 digit(s) to the left of the | 16 | 070355555588 18 | 000022233333335577777777888822335777888 20 | 00002223378800035778 22 | 0002335578023578 24 | 00228 26 | 23 28 | 080 30 | 7 32 | 2337 34 | 250077 36 | 0000823577 38 | 2333335582225577 40 | 0000003357788888002233555577778 42 | 03335555778800233333555577778 44 | 02222335557780000000023333357778888 46 | 0000233357700000023578 48 | 00000022335800333 50 | 0370 R > hist(eruptions) ## make the bins smaller, make a plot of density > hist(eruptions, seq(1.6, 5.2, 0.2), prob=TRUE) > lines(density(eruptions, bw=0.1)) > rug(eruptions) # show the actual data points hist

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 8. density density
1

30

bw

(trial-and-error)

MASS KernSmooth

Histogram of eruptions
0.7

Density

0.0

0.1

0.2

0.3

0.4

0.5

0.6

1.5

2.0

2.5

3.0

3.5

4.0

4.5

5.0

eruptions

stepfun

ecdf

> library(stepfun) > plot(ecdf(eruptions), do.points=FALSE, verticals=TRUE) eruption > > > > 3 CDF

long 3] plot(ecdf(long), do.points=FALSE, verticals=TRUE) x shapiro.test(long) Shapiro-Wilk normality test data: long W = 0.9793, p-value = 0.01052 Kolmogorov-Smirnov > ks.test(long, "pnorm", mean=mean(long), sd=sqrt(var(long))) One-sample Kolmogorov-Smirnov test data: long D = 0.0661, p-value = 0.4284 alternative hypothesis: two.sided

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 8.

32

8.3
R ctest library(ctest) (cal/gm) Rice(1995,P.490) Method A: 79.98 80.04 80.02 80.04 80.03 80.03 80.04 79.97 80.05 80.03 80.02 80.00 80.02 Method B: 80.02 79.94 79.98 79.97 79.97 80.03 79.95 79.97 box-plot A var.test(A, B) F test to compare two variances t.test

33

data: A and B F = 0.5837, num df = 12, denom df = 7, p-value = 0.3938 alternative hypothesis: true ratio of variances is not equal to 1 95 percent confidence interval: 0.1251097 2.1052687 sample estimates: ratio of variances 0.5837405

t> t.test(A, B, var.equal=TRUE) Two Sample t-test data: A and B t = 3.4722, df = 19, p-value = 0.002551 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.01669058 0.06734788 sample estimates: mean of x mean of y 80.02077 79.97875 Wilcoxon Whitney > wilcox.test(A, B) Wilcoxon rank sum test with continuity correction data: A and B W = 89, p-value = 0.007497 alternative hypothesis: true mu is not equal to 0 (null hypothesis) Mann-

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 8.

34

Warning message: Cannot compute exact p-value with ties in: wilcox.test.default(A, B)

> library(stepfun) > plot(ecdf(A), do.points=FALSE, verticals=TRUE, xlim=range(A, B)) > plot(ecdf(B), do.points=FALSE, verticals=TRUE, add=TRUE) CDF Kolmogorov-Smirnov > ks.test(A, B) Two-sample Kolmogorov-Smirnov test data: A and B D = 0.5962, p-value = 0.05919 alternative hypothesis: two.sided Warning message: cannot compute correct p-values with ties in: ks.test(A, B) qqplot Q-Q ecdf

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 9

9.1
R

expr 1; . . . ; expr m

9.2
9.2.1
R > if (expr_1) expr_2 else expr_3 expr 1 && || & | && || if/else b[i] if & | ifelse condition[i] a,b && || ifelse (condition,a,b) a[i]

if

9.2.2

for

repeat

while

loop > for (name in expr_1) expr_2 name expr 1 expr 2 dummy name expr 1

1:20 expr 2 name

35

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

CHAPTER 9. ind y x coplot() x

36

> xc yc for (i in 1:length(yc)) { plot(xc[[i]], yc[[i]]); abline(lsfit(xc[[i]], yc[[i]])) } split() help R for() ’ R ’ whole object

> repeat (expr )

> while (condition) expr break repeat next chapter 10

o

m

w w w w w w

PD

PD

F-

XC

h a n g e Vi e

w

F-

XC

h a n g e Vi e

w

er

er

!

O W

N

y

bu

to

k

lic

C

m

C

lic

k

to

bu

y

N
.c

O W w .d o c u -tr a c k

!

w

o

.d o

c u -tr a c k

.c

Chapter 10

R R R R R var(),postscript() R

function

mean(),

> name twosam

Similar Documents

Premium Essay

R Language Data Analysis

...Interface Foundation of America R: A Language for Data Analysis and Graphics Author(s): Ross Ihaka and Robert Gentleman Source: Journal of Computational and Graphical Statistics, Vol. 5, No. 3 (Sep., 1996), pp. 299314 Published by: American Statistical Association, Institute of Mathematical Statistics, and Interface Foundation of America Stable URL: http://www.jstor.org/stable/1390807 Accessed: 24/02/2009 14:04 Your use of the JSTOR archive indicates your acceptance of JSTOR's Terms and Conditions of Use, available at http://www.jstor.org/page/info/about/policies/terms.jsp. JSTOR's Terms and Conditions of Use provides, in part, that unless you have obtained prior permission, you may not download an entire issue of a journal or multiple copies of articles, and you may use content in the JSTOR archive only for your personal, non-commercial use. Please contact the publisher regarding any further use of this work. Publisher contact information may be obtained at http://www.jstor.org/action/showPublisher?publisherCode=astata. Each copy of any part of a JSTOR transmission must contain the same copyright notice that appears on the screen or printed page of such transmission. JSTOR is a not-for-profit organization founded in 1995 to build trusted digital archives for scholarship. We work with the scholarly community to preserve their work and the materials they rely upon, and to build a common research platform that promotes the discovery and use of these resources...

Words: 1190 - Pages: 5

Premium Essay

Negative Language Transfer W H E N L E a R N I N G Spanish as a Foreign Language

...NEGATIVE LANGUAGE TRANSFER W H E N L E A R N I N G SPANISH AS A FOREIGN LANGUAGE NURIA CALVO CORTÉS Universidad Complutense de Madrid RESUMEN. Este trabajo se centra en la influencia negativa de la transferencia lingüística en el aprendizaje del español como segunda lengua. Está dividido en dos partes: una teórica y un análisis práctico. La primera incluye los distintos aspectos que se tienen que tener en cuanta a la hora de considerar la transferencia lingüística. La segunda analiza distintos ejemplos de transferencia negativa que se han extraído de textos escritos por varios estudiantes británicos que están aprendiendo español. La conclusión mostrará que el análisis de estos errores puede ayudar a predecir algunos de estos errores. PALABRAS CLAVE. Influencia negativa, transferencia lingüística, español como segunda lengua, dos partes: una teórica y un análisis práctico, transferencia negativa, predecir errores. ABSTRACT. This paper focuses on the negative influence of Language Transfer on the learning process Spanish as an L2. It is divided into two main parts; a theoretical one and a practical analysis. The former includes the different aspects considering language transfer, whereas the latter analyses different mistakes due to negative transfer, which have been taken form texts written by several British students when learning Spanish. The conclusion will show that the analysis of these mistakes may help predict some of these mistakes. KEY WORDS. negative influence,...

Words: 5261 - Pages: 22

Free Essay

Transmedia Storytelling and Game of Thrones

...Dmitry Lovket, 01.04.2014 Foreword Castles, knights, dragons, battles and even newly-invented language – all these features are typically attributed with storyworlds created in the tradition of J. R. R. Tolkien. George R. R. Martin not only shares the initials with the author of The Lord of the Rings, but with A Song of Ice and Fire, has created a series of books that received enthusiastic reviews from critics and readers all over the world, nominating him the unofficial title of ―American Tolkien‖ [9]. In 2007 Martin agreed to collaborate with cable network HBO‘s writer-producers David Banioff and Daniel B. Weiss on the adaptation of his epic novel series to TV under the name Game of Thrones (GoT) [14]. Its narrative features the medieval fantasy world of Westeros, in which five noble families struggle to seize the all governing Iron Throne, and, with a complete broadcast of three seasons, the result has led TV critics to hail the show as one of the pinnacles of quality television narrative [21]. The show has also obtained an exceptionally broad and international fandom. The series has won numerous awards and nominations. It is the most recent big-budget media franchise to have contributed to the popularity of epic fantasy genre in mainstream TV. This essay will analyze the transmedia storytelling strategies applied to promote the TV series Game of Thrones. Transmedia storytelling is understood as a story told throughout numerous media platforms, with special...

Words: 7486 - Pages: 30

Free Essay

J.R.R Tolkien Biography

... it's my wonder and delight in the earth as it is, particularly the natural earth." – J.R.R. Tolkien. I love his books and now I'm here to tell you a little about his life. J.R.R Tolkien or John Ronald Reuel Tolkien was born in Bloemfontein South Africa on January 3rd, 1892. To his father and mother Arthur Tolkien and Mabel Tolkien. After his father died when he was just 4 years old, his mother took him and his little brother Hilary to hamlet of Sarehole, in Birmingham, England. His mother then died in 1904 and he and his brother were sent to live with relatives and then in boarding homes. with a catholic priest gaining guardianship in Birmingham. He would go on to get his first class degree at Exeter College, specializing in Anglo­Saxon and Germanic languages and classic literature. He enlisted as a lieutenant  Lancashire Fusiliers and served in World War I, making sure he kept writing though. He fought in the battle of somme in which there were many deaths,“I will not say, do not weep, for not all tears are an evil.” ―J.R.R. Tolkien. he eventually was released from duty due to illness. While serving though he met and married Edith Bratt in 1916. Continuing in his linguistic studies, he join the faculty of the University of Leeds in Elden Lashley Jill Decker English 101 6­12­13 Lashley2 1920 and later became a professor at Oxford University. When he was there he started a group called the Inklings, which included C.S Lewis and Owen Barfield...

Words: 1011 - Pages: 5

Premium Essay

Jrr Tolken

...The literary production I choose to write about for this assignment is titled the Hobbit written by J. R. R. Tolkien. John Ronald Reuel Tolkien was born January 3, 1892, in Bloemfontein, South Africa (Tolkienlibrary.com, 2002. para 2). He moved to back to England with his mother and brother when he was three. His family lived in poverty in Moseley, England. At the age of twelve, he and his brother were made wards of a Catholic priest after his mother died. In 1910 and 1911 young Tolkien went to school at King Edward’s School in Birmingham. He studied and did well in classical and modern language classes. After 1911, he attended Exeter College, Oxford, where he studied Classics, Old English, German, Welsh, and Finnish languages. He seemed to excel in philology where he started creating his own languages which would eventually end up in his fantasy novels (Tolkienlibrary.com, 2002. para 3). Sir Tolkien, a professor of Anglo-Saxon at Oxford University, would later on, ultimately create the fantasy world of Middle Earth. One of the characters he would create was named Bilbo Baggins, the main star of the Hobbit. This is a tale of a half -sized human like character, known as a hobbit, and his uncanny adventure with Thorin the dwarf lord and 12 militant dwarves along with and a wizard named Gandalf the gray. Their quest is to retrieve the dwarves treasure stolen by the dragon Smaug. Bilbo Baggins is to act as a burglar throughout their great adventure. As they...

Words: 584 - Pages: 3

Premium Essay

Tolkien's Legacy

...Have you ever been so lost in a book that the world on its pages seemed real? J.R .R. Tolkien was an author who inspired not only his readers but future generations of writers. His work included poetry, essays, and articles, as well as his well known, iconic novels (“Biography” 6). He created a fantasy realm called Middle Earth. His timeless works have inspired such cinematic masterpieces as The Hobbit and The Lord of the Rings Trilogy. Tolkien had a difficult childhood. John Ronald Reuel Tolkien was born on January 3 in the year 1892 of Mabel Suffield and Arthur Tolkien in Bleomfontein, South Africa (“Timeline” 1). He grew up with few memories of his birthplace, though the ones he did have were thought to influence his later writings...

Words: 858 - Pages: 4

Free Essay

The Masters of Fantasy Fiction

...The Masters of Fantasy Fiction Long ago, in a little house on Northmoor Road, there lived a jolly Englishman. With a pipe in his mouth and ungraded papers at his desk, he nonchalantly scribed the sentence "In a hole in the ground there lived a hobbit" (Collins 76). A little longer after that during a time tensioned by the exposition of World War II there lived another Englishman. Housing a family of young refugees during the blitz, he crafted a story about four young children and a magic wardrobe (Tolson 4). Though only rudimentary concepts at their formation, the ideas that these two men had at the time would eventually morph into some of the most popular stories of our age and shape the way people think about life. C.S. Lewis and J.R.R. Tolkien, two of the most brilliant authors to ever impact the world of fantasy literature, share several defining qualities in their early lives, careers, ideas, and lasting impacts. J.R.R. Tolkien and C.S. Lewis lived fairly similar yet individual childhoods. The two young authors started out in comparatively alike situations. On January 3rd, 1892, John Ronald Reuel Tolkien was born in Bloemfontein, South Africa (Collins 10), and six years later on November 29th Clive Staples Lewis was born in Belfast, Northern Ireland (Davenport 21). Both boys’ families included British parents and brothers; John's brother Arthur was two years younger (Collins 12) while Clive's brother Warren was three years older (Davenport 21). However, Tolkien seemed...

Words: 2857 - Pages: 12

Free Essay

8899

...Mara Barron Introduction            The first time I watched HBO’s Game of Thrones I was enthralled, but scared. My parents were wholly unaware of me because I would sit halfway down the stairwell to look at my grandmother’s faded painting. The painting was so lightly colored, that I could watch the TV through its reflection. So, I would sit there and watched as dead zombie-like bodies tried to rip the living to shreds, a platinum-blonde-haired woman burn her enemies alive, and seemingly everyone else get butchered. I loved watching Game of Thrones even though I found its violence, nudity, and coarse language terrifying. I kept watching the show until I was caught watching the episode, “The Red Wedding.” That night, my mother was going to my room to tuck me in for the night, but instead found me clutching the stairwell railing. I was immersed in the violence massacre scene when I felt her presences and quickly fled the scene. She came into my room and told me sternly, “that show is too “adult” for you,” and kissed me good night. But as I lay there, I couldn’t help but want to know more. Now, I am an adult and I want to revisit the episode.     Game of Thrones came out in 2011, has five seasons, been nominated for multiple Emmy awards and won, and its sixth season will be released sometime in 2016 due the massive amount of fan requests. Its franchise is so large, that a quick google search or search on the AU databases reveals that millions of people are offering their scholarly...

Words: 3333 - Pages: 14

Free Essay

Ar Rahman

...Rahman was born in Chennai, Tamil Nadu, India in a middle-class Tamil family. His father, R. K. Shekhar, was a film-score composer and conductor for Tamil and Malayalam films; Rahman assisted his father in the studio, playing the keyboard. After his father's death when Rahman was nine years old, the rental of his father's musical equipment provided his family's income.[11] Raised by his mother, Kareema (born Kashturi),[1] Rahman was a keyboard player and arranger for bands such as Roots (with childhood friend and percussionist Sivamani, John Anthony, Suresh Peters, JoJo and Raja)[3] and founded the Chennai-based rock group Nemesis Avenue.[12] He mastered the keyboard, piano, synthesizer, harmonium and guitar, and was particularly interested in the synthesizer because it was the "ideal combination of music and technology".[13] Rahman began his early musical training under Master Dhanraj,[14][15] and at age 11 began playing in the orchestra of Malayalam composer (and close friend of his father) M. K. Arjunan.[16] He soon began working with other composers, such as M. S. Viswanathan, Ilaiyaraaja, Ramesh Naidu and Raj-Koti,[15] accompanied Zakir Hussain, Kunnakudi Vaidyanathan and L. Shankar on world tours and obtained a scholarship from Trinity College London to the Trinity College of Music.[1] Studying in Chennai, Rahman graduated with a diploma in Western classical music from the school.[17] Rahman was introduced to Qadiri Islam when his younger sister was seriously ill in 1984...

Words: 1368 - Pages: 6

Free Essay

A R Rehman

...and Indian television channels. In 1987 Rahman, then still known as Dileep, composed jingles for a line of watches introduced by Allwyn. In 1992, he was approached by director Mani Ratnam to compose the score and soundtrack for his Tamil film, Roja.[19][21] Cinematographer Santosh Sivan signed Rahman for the Malayalam film Yodha, directed by Sivan's brother Sangeeth Sivan and released in September 1992. The following year, Rahman received the Rajat Kamal (Silver Lotus) award for best music director at the National Film Awards for Roja. The films' score was critically and commercially successful in its original and dubbed versions, led by the innovative theme "Chinna Chinna Aasai". Rahman followed this with successful scores for Tamil–language films for the Chennai film industry, including Ratnam's politically-charged Bombay, the urban Kadhalan, Thiruda Thiruda and S. Shankar's debut film Gentleman (with its popular dance song, "Chikku Bukku Rayile").[22][23][24][25] Rahman collaborated with director Bharathiraaja on Kizhakku Cheemayile and Karuththamma, producing successful Tamil rural folk-inspired scores; he also composed the saxophone score for K. Balachander's Duet.[26][27] The 1995 film Indira and romantic comedies Mr. Romeo and Love Birds also drew attention.[28][29][30] Rahman attracted a Japanese audience with Muthu's success there.[31] His soundtracks are known in the Tamil Nadu film industry and abroad for his versatility in combining Western classical music, Carnatic...

Words: 1521 - Pages: 7

Free Essay

I Belive in Reading

...When I started writing this paper I was going to just talk about books and reading Then I got sidetracked so this paper is more about books vs. the computer and books and the computer combined as learning tools. Reading is very important to enrich a person's life. If you can read you can learn anything. You can go anywhere, be anyone, do anything. Books can open a world to the past, the present and the future. They can also take you to fantasy lands that never existed in the real world. Through books you can experience what it is like to be an explorer, you can go to the moon and outer space, you can live with cavemen, you can experience what it was like to be a pirate in the 1600s. You can give yourself an entire college education with the books that can be found in any public library. For an example John Aristotle Phillips was born in 1955 in Connecticut. In 1976, while attending Princeton University as a junior undergraduate, he designed a nuclear weapon using publicly available books and papers. Books are very cheap entertainment. Used books can be purchased for a dollar or less. Many famous people learned things from books rather than in a structured educational environment. Today you can use the internet to enhance your reading experience. I have read several books that led me to the internet because I wanted to know more about some of the things or people mentioned in the books. Other times I have written down words I didn't know the meaning of and looked them up...

Words: 703 - Pages: 3

Premium Essay

Bilbo's Archetypes In The Hobbit

...The Hobbit is a wonderful book to read. J.R.R Tolkien who is the author of the Hobbit used various archetypes throughout the novel. Some archetypes that J.R.R Tolkien used in the Hobbit are communion, the hero, and the journey. The main character in the Hobbit is Bilbo Baggins and you wouldn’t think that a person with the personality of Bilbo would be the hero. Bilbo Baggins didn’t have any ambition in his life, he had hobbies but they were boring hobbies. In the beginning of the Hobbit J.R.R. Tolkien uses the archetype of communion. Most people think of holy ceremony that takes place in church were everybody gets a small cup of grape juice and a tiny piece of bread. Communion is the act of intimate fellowship and rapport. Communion doesn’t have to happen in a church in fact you don’t just have to eat bread and drink grape juice. That is shown in the Hobbit because when Bilbo, Gandalf and the twelve dwarfs were eating dinner together that is also known as communion. When Bilbo leaves his Hobbit hole that is when the journey starts. The task for Bilbo Baggins is to help the dwarfs reclaim their treasure from Samug. During the beginning of their journey they encounter three hungry trolls who capture them all expect Gandalf. Gandalf saves them by tricking the trolls to stay outside into the sun comes up because they will have turned into stone. After the group has been saved they found weapons in the trolls’ camp and Gandalf and Thorin turned the swords into magic swords, Bilbo didn’t...

Words: 801 - Pages: 4

Free Essay

J.R.R. Tolkien

...J.R.R. Tolkien My selection for this project was J.R.R. Tolkien. The reason I chose this individual was because of his books such as “The Hobbit” (J.R.R. Tolkien- 1936) this book has such realistic characteristics along with mythological characteristics. The other books I liked were “Lord of the Rings” which was broken into sequels. There orders were “The Fellowship of the Ring” and “The Two Tower” they were published in Great Britain in 1954. The third one was published in 1955 it was called “The Return of the King.” These great books kept me on my toes; I did not want to put them down. It is hard to actually find a good book to read that will keep your attention throughout and also make you feel like you are in the big picture yourself. J.R.R. Tolkien overcame many obstacles to achieve his successes a writer and also a teacher. In 1896 his father (Alfred Tolkien) died of Rheumatic fever. His mother (Mabel Tolkien) died from diabetes in November of 1904. J.R.R. Tolkien and his brothers were orphaned until they were taken in by a priest (Francis Xavier Morgan). In 1916 J.R.R. Tolkien went off to WW1 in 1916, and contracted “trench fever” in 1917. J.R.R. Tolkien was discharged from the military in 1917. After dealing with all of this he yet managed to be married, return to college, attain degrees and also pursue his writing and teaching. These were a lot of obstacles to overcome but J.R.R. Tolkien did. He has a strong will, and such a passion and desire to...

Words: 753 - Pages: 4

Free Essay

The Hobbit

...literature? “In a hole in the ground there lived a hobbit.” What knowledge did Tolkien draw from to write The Hobbit’s characters and plot? ancient mythology, primarily northern (Norse) mythology. Middle-Earth: Why did Tolkien first begin writing his imagined world? ________________________________________________________________________ “Tolkien’s Middle-earth is a fully-formed world with its own _______________, ______________, ________________, ‘_____________’, a _______________ story, a Fall, grief, joy, and all of those many things that our own world has.” Middle-Earth: Tolkien and Language Which languages did Tolkien have an affinity for? ______________________________ Tolkien created _______ languages for Middle-earth’s various races, and in many respects these languages predate the stories themselves. The Elven languages are loosely based on ___________________ and _____________. Middle-earth: Tolkien and Mythology “Tolkien brought this love and knowledge of mythology to bear on his fiction as well. It is most directly apparent in The Hobbit, where many of the names and events can be traced in some form to mythology, particularly the _____________ myth...

Words: 367 - Pages: 2

Free Essay

Value of Literature

...The Value of Literature Literature can be used to place value on a wide span of topics. From books that may break our hearts to one’s that make us laugh uncontrollably. Even though literature is only written in words, it is our imagination that makes those words come to reality, by the way we see the words in our imaginations. Whatever literature that is read, it is in the perspective of the author and you are reading through the lens of the writer. Philip Marchand said “Not to understand the disposition of things is the fate of children or slaves. Imaginative literature is the race's best tool for acquiring such understanding. This is the childishness and slavishness in the soul of someone who cannot respond to great literature.” Marchand talks about how our imagination is one of the most important tools that an individual can have. Ultimately, with the way literature uses up the creativity side of the brain, it truly helps expand our imagination. From a very young age, many of us were introduced to books with big pictures and little words. These simple little books were meant to teach us the names of colours, the alphabet and what noise animals made. While continuing to grow older, individuals starts to explore more genres of literature to find what they enjoy. For example, in the last couple years of high school, I have really gotten into the horror/mystery genres of book which is the reason I chose The Shining as my ISU novel. The fact that I had read The Shining before...

Words: 1343 - Pages: 6