What's that data type in R?

R Programming Language Data Types in R Language (Article) Data Types in R Language (Program)

335

Program:

# Declare variables of different types
my_numeric <- 42
my_character <- "universe"
my_logical <- FALSE 

# Check class of my_numeric
class(my_numeric)

# Check class of my_character
class(my_character)

# Check class of my_logical
class(my_logical)

 

Output:

> # Declare variables of different types
> my_numeric <- 42
> my_character <- "universe"
> my_logical <- FALSE
> 
> # Check class of my_numeric
> class(my_numeric)
[1] "numeric"
> 
> # Check class of my_character
> class(my_character)
[1] "character"
> 
> # Check class of my_logical
> class(my_logical)
[1] "logical"

Explanation:

Complete the code in the editor and also print out the classes of my_character and my_logical.


This Particular section is dedicated to Programs only. If you want learn more about R Programming Language. Then you can visit below links to get more depth on this subject.