In R, the is.numeric() function returns a logical value, TRUE or FALSE, indicating if the argument passed to it has a base type of the class double or integer and the values are regarded as numeric.
is.numeric(x)
This function takes a single parameter value, x, which represents an R object to be tested.
This function returns TRUE if the argument is numeric and FALSE otherwise.
# implementing the is.numeric() functionis.numeric(20)is.numeric("twenty")is.numeric(4.5)
Line 2: We use the is.numeric() function on an argument, 20, to check if it is a numeric value or not. It returns true.
Line 3: We use the is.nuemric() function on an argument, "twenty", to check if it is a numeric value or not. It returns false.
Line 4: We use the is.numeric() function on an argument, 4.5, to check if it is a numeric value or not. It returns true.