Check if Object is of the Character Data type in R Programming – is.character() Function
Last Updated :
03 Jun, 2020
is.character()
Function in R Language is used to check if the object is of the form of a string/character or not. It will return true if any element of the object is of the character data type.
Syntax: is.character(Object)
Parameter:
Object: It could be an array, list, vector, etc.
Example 1:
x1 < - c( "Hello" , "Geeks" , 100 )
x2 < - c( 10 , 20 , 30 )
is .character(x1)
is .character(x2)
|
Output:
[1] TRUE
[1] FALSE
Example 2:
vector1 < - c( 1 , 2 , 3 )
vector2 < - c( "GFG" , "Geeks" , "Hello" )
result < - array(c(vector1, vector2), dim = c( 3 , 3 , 2 ))
is .character(result)
|
Output:
[1] TRUE
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...