| To: | "Heymans, MW" <mw.heymans@vumc.nl> |
|---|---|
| Subject: | Re: select vector names |
| From: | David L Lorenz <lorenz@usgs.gov> |
| Date: | Thu, 11 May 2006 07:24:47 -0500 |
| Cc: | "s-news" <s-news@lists.biostat.wustl.edu>, s-news-owner@lists.biostat.wustl.edu |
| In-reply-to: | <B8CF0F16EE1E1B42854D9ACCEB60686427400B@vumc-mb01.vumc.nl> |
|
Martijn, The hmisc library contains a function sedit() that will remove the =n part. Then use the unique() function to get the unique names in the vector. Like this: Vect <- c("FA", "WLV=2", "WLV=3", "WLV=4", "TS", "BAE", "BH", "WKZ", "RDQB", "gr=1", "gr=2", "gr=3", "gr=4", "gr=5", "gr=6", "gr=7") library(hmisc) unique(sedit(Vect, "=*", "")) Dave
Dear all, I have this vector of names: [1] "FA" "WLV=2" "WLV=3" "WLV=4" "TS" "BAE" "BH" "WKZ" "RDQB" "gr=1" "gr=2" "gr=3" "gr=4" "gr=5" "gr=6" [16] "gr=7" and I want to change it to (same order, but without the factor extensions): [1] "FA" "WLV" "TS"
"BAE" "BH" "WKZ"
"RDQB" "gr"
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Replicating the rows of a table n times each, Tzamouranis, Ioannis C |
|---|---|
| Next by Date: | Help with modelling, Tristan Lorino |
| Previous by Thread: | select vector names, Heymans, MW |
| Next by Thread: | Re: select vector names, Tony Plate |
| Indexes: | [Date] [Thread] [Top] [All Lists] |