[R] string concatenation operator

Liaw, Andy andy_liaw at merck.com
Thu Feb 24 22:18:06 CET 2005


I believe not, because:

> get("+")
.Primitive("+")

i.e., it's not an S3 generic.

Andy

> From: Spencer Graves
> 
>       Can we do something to make the following work: 
> 
>  > "+.character" <- function(x,y) paste(x,y,sep="")
>  > "abc"+"def"
> Error in "abc" + "def" : non-numeric argument to binary operator
> 
>       Thanks,
>       spencer graves
> 
> Gabor Grothendieck wrote:
> 
> >Harris A. Jaffee <hjaffee <at> jhmi.edu> writes:
> > 
> >: Why doesn't R have one, like "." in Perl or juxtaposition in awk?
> >
> >You could define one like this:
> >
> >R> "%+%" <- function(x,y) paste(x,y,sep="")
> >R> "abc" %+% "def"
> >[1] "abcdef"
> >
> >______________________________________________
> >R-help at stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> >  
> >
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list