Data Types in R Programming Language: Overview and Examples
In contrast to other programming languages like C and Java in R, the variables are not declared as some data type. The variables are assigned with R-Objects and the data type of the R-object becomes the data type of the variable. There are many types of R-objects. The frequently used ones are ?
- Vectors
- Lists
- Matrices
- Arrays
- Factors
- Data Frames
The simplest of these objects is the vector object and there are six data types of these atomic vectors, also termed as six classes of vectors. The other R-Objects are built upon the atomic vectors.
| Data Type | Example | Verify |
|---|---|---|
| Logical | TRUE, FALSE |
it produces the following result ?
|
| Numeric | 12.3, 5, 999 |
it produces the following result ?
|
| Integer | 2L, 34L, 0L |
it produces the following result ?
|
| Complex | 3 + 2i |
it produces the following result ?
|
| Character | 'a' , '"good", "TRUE", '23.4' |
it produces the following result ?
|
| Raw | "Hello" is stored as 48 65 6c 6c 6f |
it produces the following result ?
|
| Date | "2019-08-07" |
it produces the following result ?
it produces the following result ?
|