Perhaps, the following construct does what you need:

paste(c("a", "b", "c"), c(",", ":", ""), sep="",collapse="")

Regards,
Jan



On 29-10-2010 10:49, Ron Michael wrote:
Hi all, I want to club different objects (character type) to a single one and using 
paste() function that can be done happily. However the problem with paste function is the 
separator field is unique for all underlying objects. If I put separator as "-" 
then this will come in between all underlying objects which are to be clubbed.
Therefore I am wondering whether there is any mechanism to put different separators for different places. Trivially this can be done by applying paste() function repeatedly. However I feel there must be some single mechanism for doing that. Here is one example, where I apply paste() function twice to incorporate 2 different separators:
paste(paste("a", "b", sep=","), "c", sep=":")
[1] "a,b:c"

Can the same thing be done using paste() function once? something like:
paste("a", "b", "c", sep=c(",", ":")) # this put 1st separator everywhere which 
is not intended
Thanks,


        [[alternative HTML version deleted]]



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to