[R] string concatenation operator

Harris A. Jaffee hjaffee at jhmi.edu
Thu Feb 24 21:20:24 CET 2005


Why doesn't R have one, like "." in Perl or juxtaposition in awk?

It does not seem impossible to introduce one, if that would be
reasonable.  It would seem to involve adding a table entry to
main/names.c for the binary operator and a corresponding internal
function, say do_dot().  This cannot be simply do_paste(), since
the implied separator is "".  So, do_dot() might be similar, but
if it finds a non-string operand, a syntax error would be issued,
in place of the message from do_paste() noting a bad *argument*.
Precedence must be decided, but it may not matter.  For example,

	"a" . "b" + 1

If . precedes +, then a syntax error results, after "a" . "b" is
computed.  If + precedes ., then an error happens, just earlier.

What else, or is this a dumb idea?




More information about the R-help mailing list