The character class
Characters are what other languages call ‘string vectors.‘
Coercion
Section titled “Coercion”To check whether a value is a character use the is.character() function. To coerce a variable to a character use the as.character() function.
x <- "The quick brown fox jumps over the lazy dog"class(x)[1] "character"is.character(x)[1] TRUENote that numerics can be coerced to characters, but attempting to coerce a character to numeric may result in NA.
as.numeric("2")[1] 2as.numeric("fox")[1] NAWarning message:NAs introduced by coercionRemarks
Section titled “Remarks”Related topics
Section titled “Related topics”Patterns
Input and output