Comparing atomic and list types in R

I get an error in the following code

> a <- dplyr::mutate
> a == dplyr::mutate
Error in a == dplyr::mutate : 
  comparison (1) is possible only for atomic and list types

How can I do this comparison then?
The use case is to put within a function with a as an argument. If a is the function dplyr:::mutate, i would want to do a certain execution.

>Solution :

You can use the identical function:

> a <- dplyr::mutate
> identical(x = a, y = dplyr::mutate)
[1] TRUE

Leave a Reply