s-news
[Top] [All Lists]

Re: [S] vector subscripting question

To: s-news@wubios.wustl.edu
Subject: Re: [S] vector subscripting question
From: Fei Chen <fchen@stern.nyu.edu>
Date: Thu, 25 Jun 1998 12:28:41 -0400 (EDT)
In-reply-to: <199806251607.JAA12277@aggie.pnl.gov>
Reply-to: Fei Chen <fchen@stern.nyu.edu>
Sender: owner-s-news@wubios.wustl.edu
hi all,

thanks for all these quick response.  i can't believe how obvious this
should have been in hind sight. i guess i was just a little confused over
a coincidental example i had.

thanks to  Z. Todd Taylor, Anne York, Larry Zaborski, Diane Liu, and
George W. Gilchris.

an example from Anne York says it all:
------------------ 
a <- 1:21
b <- 10:10
 
> a
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
21
> b
 [1] -10  -9  -8  -7  -6  -5  -4  -3  -2  -1   0   1   2   3   4
5   6   7   8
[20]   9  10
> 
> a[b>0]
 [1] 12 13 14 15 16 17 18 19 20 21
 
> b[b>0]
 [1]  1  2  3  4  5  6  7  8  9 10
>
 
> a[b[b>0]]
 [1]  1  2  3  4  5  6  7  8  9 10
--------------------

fei

> > i thought i had understood this, but maybe not. let's say i have two
> > vetors a and b of length 120000, should these two expressions be the same? 
> > 
> > 1.  a[b>0]
> > 
> > 2.  a[b[b>0]]
> > 




-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>