s-news
[Top] [All Lists]

Re: add info to columns

To: 'jose Bartolomei' <surfprjab@hotmail.com>, s-news@lists.biostat.wustl.edu
Subject: Re: add info to columns
From: "Bos, Roger" <BosR@ny.rothinc.com>
Date: Thu, 16 Dec 2004 08:17:55 -0500
Jose,

One way is using the paste command to concatenate strings together.  Numeric
strings can easily to coerced back to numbers later.

HTH,

Roger


> a <- c("abc", 123)
> dim(a) <- c(1,2)
> b <- cbind(a, paste(a[,1], a[,2], sep=""))
> a
     [,1]  [,2] 
[1,] "abc" "123"
> b
     [,1]  [,2]  [,3]    
[1,] "abc" "123" "abc123"
> 

-----Original Message-----
From: jose Bartolomei [mailto:surfprjab@hotmail.com]
Sent: Thursday, December 16, 2004 8:07 AM
To: s-news@lists.biostat.wustl.edu
Subject: [S] add info to columns


Dear S-Plus users.

I have not found a way to add information from different columns into 
another one.

For example:
Column 1        Column 2        Column 3
abc     123     abc123


How can I do that?
Thank you very much

Happy Christmas,
Jose
Research Degree Student
London School of Hygiene & Tropical Medicine


--------------------------------------------------------------------
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

********************************************************************** * This 
message is for the named person's use only. It may 
contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment 
of this message is waived or lost by any error in 
transmission. If you have received this message in error, 
please immediately notify the sender by e-mail, 
delete the message and all copies from your system and destroy 
any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message 
if you are not the intended recipient. 
**********************************************************************

<Prev in Thread] Current Thread [Next in Thread>