| To: | yiwu ye <yiwu21111958@yahoo.com> |
|---|---|
| Subject: | Re: Compare two vectors without a loop |
| From: | Sundar Dorai-Raj <sundar.dorai-raj@pdf.com> |
| Date: | Fri, 27 Jun 2003 08:33:36 -0500 |
| Cc: | s-news@lists.biostat.wustl.edu |
| Organization: | PDF Solutions, Inc. |
| References: | <20030627022121.57421.qmail@web13302.mail.yahoo.com> |
| User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 |
yiwu ye wrote: Dear list members,suppose I have:x y 1 3 2 4 3 5 4 6 5 6I want to make a comparison between x and y, and to produce a new vector likez T T T F Fso, I can know the first three elements of y, 3,4,5,can find the same value in x.Could someone told how I can do it without a loop, please? Many thanks.Yiwu In S-PLUS 6.1 just use the %in% operator: z <- y %in% xIn older versions of S-PLUS, library(hmisc) has the %in% operator or just use ?match. Regards, Sundar |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Cov.mcd running low on R, José Lozano Alonso |
|---|---|
| Next by Date: | Re: Real-Life, Brian S Cade |
| Previous by Thread: | Compare two vectors without a loop, yiwu ye |
| Next by Thread: | Cov.mcd running low on R, José Lozano Alonso |
| Indexes: | [Date] [Thread] [Top] [All Lists] |