R duplicates the function without handling incomparable

I am trying to use duplicated

to search for rows in a dataframe that are only duplicated based on two columns.

When I pass anything to the argument incomparables

, I get the error

dups = duplicated(data, incomparables="Age")
...
argument 'incomparables != FALSE' is not used (yet)

      

I cannot figure it out.

This question seemed to have a similar unanswered issue.

There is no doubt another way to do the same, which would be good to know as I am new to R.

+3


source to share


1 answer


First of all, after reading the documentation ?duplicated

, you will understand that the argument incomparables

takes a vector of values ​​that should not be compared, not a column name, and I quote:

a vector of values ​​that cannot be compared.

And in more detail

Values ​​that are not comparable will never be marked as duplicate. This is intended to be used for a fairly small set of values, and will not be efficient for a very large set.



In any case, the source code implies that you cannot even use it even if you followed the documentation, because this feature appears not yet implemented

if(!identical(incomparables, FALSE))    
   .NotYetUsed("incomparables != FALSE")

      

Although back to your question to run duplicated

for two columns, you can explicitly call them, for example

duplicated(data[c("col1", "col2")]) ## (if the desired columns called col1 and col2)

      

+5


source







All Articles