Hello,

R is open source, you can see exactly what is the internal working of any function. You can have access to the code by typing the function's name without parenthesis at an R command line.

> duplicated
function (x, incomparables = FALSE, ...)
UseMethod("duplicated")
<bytecode: 0x55e5ef683040>
<environment: namespace:base>

Now, this tells users that duplicated is a generic function, and that there are methods written to handle the different S3 classes of objects x.
When this happens, there is always a default method, duplicated.default

> duplicated.default
function (x, incomparables = FALSE, fromLast = FALSE, nmax = NA,
    ...)
.Internal(duplicated(x, incomparables, fromLast, if (is.factor(x)) min(length(x),
    nlevels(x) + 1L) else nmax))
<bytecode: 0x55e5ef6826a0>
<environment: namespace:base>


The default method calls .Internal(duplicated, etc). So you'll have to download the R sources, if you haven't done it yet, and search for a file where that function might be. The file is

src/main/duplicate.c


Good reading.
Also, like the posting guide asks R-Help users to do, please post in plain text, not in HTML.

Hope this helps,

Rui Barradas

Às 12:54 de 04/08/20, K Purna Prakash escreveu:
Dear Sir(s),
I request you to provide the detailed* internal mathematical working
mechanism of the following function *for better understanding.
*x[duplicated(x) | duplicated(x, fromLast=TRUE), ]*
I am having some confusion in understanding how duplicates are being
identified when thousands of records are there.
I will look for a positive response.
Thank you,
K.Purna Prakash.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to