Thank you all, for your one liners!!
-Sohail
-----Original Message-----
From: Chuck Cleland [mailto:ccleland@optonline.net]
Sent: Friday, June 16, 2006 12:48 PM
To: Khan, Sohail
Cc: s-news@lists.biostat.wustl.edu
Subject: Re: [S] reversing the order of strings
Sorry, strsplit() is only in R.
Chuck Cleland wrote:
> Another one-liner:
>
> X <- c("abc", "ffd", "sad")
>
> sapply(lapply(strsplit(X, split=""), rev), paste, collapse="")
>
> [1] "cba" "dff" "das"
>
> Khan, Sohail wrote:
>> Dear List,
>>
>> I have character vector as follows:
>> "abc"
>> "ffd"
>> "sad"
>> How can I reverse the string so that
>> "cba"
>> "ffd"
>> "das"
>>
>> Thanks.
>>
>>
>> Sohail Khan
>> Scientific Programmer
>> COLD SPRING HARBOR LABORATORY
>> Genome Research Center
>> 500 Sunnyside Boulevard
>> Woodbury, NY 11797
>> (516)422-4076
>>
>> --------------------------------------------------------------------
>> 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
>>
>
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
|