[R] here's why it make s sense
Paul Johnson
pauljohn at ku.edu
Fri Mar 4 23:39:49 CET 2005
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 at 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
More information about the R-help
mailing list