[R] string concatenation operator
Spencer Graves
spencer.graves at pdf.com
Thu Feb 24 21:45:54 CET 2005
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
>
>
More information about the R-help
mailing list