Skip to content

here's why it make s sense

1 message · Paul Johnson

#
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