Data types in R

Everything in R is in the form of objects. Objects can be manipulated in R. Some of the common objects in R are numeric vectors, character vectors, complex vectors, logical vectors, and integer vectors.

Data types in R

How to do it…

In order to generate a numeric vector in R, we can use the C() notation to specify it as follows:

x = c(1:5) # Numeric Vector

To generate a character vector, we can specify the same within quotes (" ") as follows:

y ="I am Home" # Character Vector

To generate a complex vector, we can use the i notation as follows:

c = c(1+3i) #complex vector

A list is a combination of a character and a numeric vector and can be specified using ...

Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.