R Programming Fundamentals
上QQ阅读APP看书,第一时间看更新

Character

Character data is always mentioned in quotation marks; anything contained in quotation marks is called a character string. Usually, character data is of both class and type character.

Let's create and check the class() and typeof() of different character objects in R. Follow the steps given below:

  1. Create the following objects:
a <- "apple"
b <- "7"
c <- "9-5-2016"
  1. Check the class and type of each using class() and typeof(), respectively, as follows:
class(a)
typeof(a)

class(b)
typeof(b)

class(c)
typeof(c)

Output: The preceding code provides the following output: