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