2

I am new to the R language. I would like to ask where can I see the content of R functions, I tried to type the function name 'paste' and 'paste0' from the RStudio and I am a bit confused because from what I can see, there will be an infinite recursive loop every time we call paste() function which is certainly not the case because paste() is just like the join() in other languages (such as java). This is the content of paste and paste0 which is exactly the same just the naming is different.

function (..., sep = " ", collapse = NULL, recycle0 = FALSE) 
{
    if (isTRUE(recycle0)) 
        .Internal(paste(list(...), sep, collapse, recycle0))
    else .Internal(paste(list(...), sep, collapse))
}

Any information regarding the GitHub page of R language packages would also be appreciated, unlike golang where we can see the detailed implementation of the packages, R language seems to be quite secluded.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    Relevant post to see the content of functions: https://stackoverflow.com/q/19226816/680068 and https://stackoverflow.com/q/14035506/680068 – zx8754 Jun 03 '21 at 08:51
  • 1
    It is not infinite loops, as paste is calling internal *other* paste function. – zx8754 Jun 03 '21 at 08:52
  • @zx8754 Hello, thank you for your response. Can we see the inside or the source code for Internal and Primitive functions? Based on this one: https://stackoverflow.com/questions/14035506/how-to-see-the-source-code-of-r-internal-or-primitive-function it implies that we cannot see the insides of the Internal or Primitive functions because it is probably implemented in C. Anyway, I could not find any file named "names.C" in my $R.Home directory – Refo Ilmiya Jun 03 '21 at 15:56
  • @RefoIlmiya Check out this answer. It has a section on "Functions that call compiled code". Since R is open source, you can jump back into the source code in these cases. Just need to know where to look. https://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function –  Jun 04 '21 at 13:21

0 Answers0