Hi,
It would be interesting to have such behavior, but I think you would
then need to specify every separator, for example like this:
paste("a", "b", "c", sep=c(",", ",", ":"))
Otherwise, R cannot know where to put each separator.
So at the end, it's not much different from several paste() calls, isn't it?
It could be possible to write your own function, but I have not much
idea how (I mean to make it work in every case, independently of the
number of separators)
Ivan
Le 10/29/2010 10:49, Ron Michael a écrit :
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.
--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de
**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php
______________________________________________
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.