[R] here's why it make s sense

From: Paul Johnson <pauljohn_at_ku.edu>
Date: Sat 05 Mar 2005 - 09:39:49 EST


if you go

x[i]

you are giving x an "index vector", which we had mistakenly thought was an integer. Rather, it is a vector of indices for observations. Here's data

x <- c(1 , 4, 3, 2, 5)

x[1] would be 1
x[2] would bd 4

but if you put an "index vector" in the brackets, you have

x [ c(1,2,1,2] ]

it means take the first, the second, the first, the second, so

x [ c(1,2,1,2] ]

is

1, 4, 1, 4

So in the procedure diff.ttest, when we have x[i] and y[i], we mean "take the vectors x and y after grabbing the index values selected for each resample"

That page I sent you a minute ago is from R by Example, which I think is quite great.

http://www.mayin.org/ajayshah/KB/R/index.html

pj

-- 
Paul E. Johnson                       email: pauljohn@ku.edu
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Mar 05 09:50:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST