Skip to content
Prev 43624 / 398513 Next

Passing characters by .Call

Another incantation that helps when you are passing a single character
string is
  CHAR(asChar(x))
because asChar will check the type of its argument and coerce it if
necessary.

Similar functions called asInteger, asLogical, and asReal exist for
other types.

Note that these only give you the first element of their argument (or
NA if the argument has length zero or cannot be coerced).