| To: | s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | problem in substring() |
| From: | Nora Muda <noramuda@yahoo.com> |
| Date: | Wed, 24 Jan 2007 00:52:14 -0800 (PST) |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=rOeAOLEx2B+K+XiYgALaSJgOh6UZGmI3ewRo7j3j9ohKCu8/V1keAWoCs/bB5lXru71j7rGedyevSF8I8wZoPXTG9eLx18i1QBC5/AG4ibUaiZR7PHGQ5wGvIsw3NK7N48ZqZXL8J1a79vCe84Zh2Etoj6tOgZuKJ4sXZ1uw1a8=; |
|
Dear S-Plus users,
I have problems in using substring ( ) function. My question may looked simple to all of you, since I am new to Splus. I have problems to get back my 2 digits number after did paste ( ) function.
Let say I have 10 numbers.
>y <- c(1:10)
>a <- as.numeric(paste(y[1],y[10],sep=""))
$a:
[1] 110
then I want to separate it back apart;
>as.numeric(substring(a,1,1))
[1] 1
>as.numeric(substring(a,2,2))
[1] 1 <------------ suppose I want '10' not '1'
I noticed that substring( ) separate one string at a time, how to do if we want 2 strings as my example above?
Hopefully someone will help to answer my questions.
Thank you in advance.
--Nora. Need a quick answer? Get one in minutes from people who know. Ask your question on Yahoo! Answers. |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Indirect references in SPLUS, Santosh |
|---|---|
| Next by Date: | Re: substring()'s problem, Nora Muda |
| Previous by Thread: | DSC 2007 Additional Funding, Paul Murrell |
| Next by Thread: | Re: problem in substring(), Mario Cortina Borja |
| Indexes: | [Date] [Thread] [Top] [All Lists] |