[R] change the default separator

Gabor Grothendieck ggrothendieck at myway.com
Wed Mar 10 16:05:17 CET 2004


You could define your own function:

   paste0 <- function( ..., sep="" ) paste( ..., sep = sep )

which is used like this:

   > paste0("large","st")
   [1] "largest"

or perhaps you might want to define an infix operator to do
this:

   "%+%" <- function(x,y) paste(x,y,sep="")

which is used like this:

   > "large" %+% "st"
   [1] "largest"


It would be nice if a convenience wrapper such as paste0 were 
part of the base since I too find that I often use sep="" on 
paste.  Other areas of R such as ISOdate and table.csv are 
wrappers.

---

Hello,

How do I permanently change the separator in "paste" and "cat"
that by default is set to " " ?
(so that I dont have to say sep="" any time I use paste or cat)



regards, R. Alberts


-- 
Drs. R. Alberts
Groningen Bioinformatics Centre (GBIC)
Dep. of Mathematics and Computing Science
University of Groningen (RuG)
 
P.O. Box 800
9700 AV  Groningen
The Netherlands

tel. Haren     +31 50 363 8082
tel. Groningen +31 50 363 3957




More information about the R-help mailing list