2.4.1 Basic Data Types
- Numeric: Represents real numbers (both integers and decimals).
x = 3.14; y = 2
class(x)
class(y)This is a sample sentence with an annotated text that shows additional information on hover.
- Integer ( NE ): Represents whole numbers explicitly (defined with L).
x = 5L; y = c(1L, 2L)
class(x)
class(y)- Complex ( NE ): Represents complex numbers with real and imaginary parts.
x = 1 + 2i
class(x)- Character: Represents strings of text enclosed in quotes.
x = "Machine Learning"
class(x)- Logical: Represents Boolean values: TRUE or FALSE.
x = TRUE; y = FALSE
class(x)
class(y)
x & y # '&' is the AND operator
x | y # '|' is the OR operator
x + y # Can we calculate it?
x/y # And this?Remark: if you apply basic arithmetic operators to logical values, then they will be transformed to numeric first, and then execute the calculations.
