Dear Simon,
At 08:40 AM 3/23/2003 -0500, Rosenfeld, Simon (NIH/NCI) wrote:
Dear colleagues:
I have a set of long names structured as follows:
ABCD~~blablablablablablablablabla
EFGHI~~boobooboobooboo
JKL~~foofoofooblablabooboo
MNOPQRST~~oopsoopsoops
,etc.
I need to abbreviate these names in order to obtain
ABCD
EFGHI
JKL
MNOPQRST
etc.
Any suggestions?
You can use regexpr and substring; for example:
> name <- "ABCD~~blablablablablablablablabla"
> substring(name, 1, regexpr("~", name) - 1)
[1] "ABCD"
>
I hope that this helps,
John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox@mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news