Home > Back-end >  Comparing atomic and list types in R
Comparing atomic and list types in R

Time:07-28

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.

CodePudding user response:

You can use the identical function:

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