Open In App

Getting type of different data types in R Programming - typeof() Function

Last Updated : 12 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
typeof() function in R Language is used to return the types of data used as the arguments.
Syntax: typeof(x) Parameters: x: specified data
Example 1: Python3
# R program to illustrate
# typeof function

# Specifying "Biochemical oxygen demand"
# data set
x <- BOD
x

# Calling typeof() function
typeof(x)
Output:
  Time demand
1    1    8.3
2    2   10.3
3    3   19.0
4    4   16.0
5    5   15.6
6    7   19.8
[1] "list"
Example 2: Python3
# R program to illustrate
# typeof function

# Calling typeof() function 
# over different types of data 
typeof(2)
typeof(2.8)
typeof("3")
typeof("gfg")
typeof(1 + 2i)
Output:
[1] "double"
[1] "double"
[1] "character"
[1] "character"
[1] "complex"

Next Article

Similar Reads