
Working with Character Data 155
> pmatch(c("ab"), c("ab", "ab"))
[1] 1
> charmatch(c("ab"), c("ab", "ab"))
[1] 0
5.2.4 Formatting text and numbers
Formatting text and numbers can be accomplished in a variety of different
ways. Formatting character strings or numbers, including interpolation of
values into character strings, can be accomplished using paste and sprintf.
Formatting of numbers can be achieved using either format or formatC. Use
the xtable package for formatting R objects into L
A
T
E
Xor HTML tables. The
function sprintf is an interface to the C routine sprintf, which supports all
of the functionality of that routine, with R-style vectorization. ...