# R program to illustrate# mode function# Initializing some values
x <-3
y <-"a"# Calling the mode() function
mode(x)
mode(y)
R
输出
[1]"numeric"[1]"character"
R
例2 :
# R program to illustrate# mode function# Initializing some values
x <-3
y <-"a"# Calling mode() function to# set the storage mode of the object
mode(x)<-"character"
mode(y)<-"numeric"# Getting the assigned storage mode
mode(x)
mode(y)