character {base} | R Documentation |
Create or test for objects of type "character"
.
character(length = 0)
as.character(x, ...)
is.character(x)
length |
desired length. |
x |
object to be coerced or tested. |
... |
further arguments passed to or from other methods. |
character
creates a character vector of the specified length.
The elements of the vector are all equal to ""
.
as.character
attempts to coerce its argument to character type.
is.character
returns TRUE
or FALSE
depending on
whether its argument is of character type or not.
as.character
truncates components of language objects to 500
characters (was about 70 before 1.3.1).
paste
, substr
and strsplit
for character concatenation and splitting,
chartr
for character translation and casefolding (e.g. upper
to lower case) and sub
, grep
etc for
string matching and substitutions. Note that
help.search(keyword = "character")
gives even more links.
deparse
, which is normally preferable to
as.character
for language objects.
form <- y ~ a + b + c
as.character(form) ## length 3
deparse(form) ## like the input