Section 13 R Atomic Class: Character

  • A character vector stores text information

  • A character vector is created by typing a character or string of characters enclosed by quotes.

  • R will look for an object with the same name if you miss the quotation marks for the character strings.

  • Expect an error whenever you forget your quotation marks; R will look for an object with the same name which may not exist.

  • Function to identify the object type: class, typeof, mode

  • Other functions to check the object type as character: is.character

13.1 Examples

x <- "my"
x
class(x)
typeof(x)
mode(x)
is.character(x)

y <- 'my text here '
y
class(y)

z <- 'Sam'
z
class(z)
is.character(z)

a <- 'Ten'
a
class(a)
is.character(a)

b <- '10'
b
class(b)
is.character(b)

c <- 'TRUE'
c
class(c)
is.character(c)