Question: Neither of these show the source code of `pnorm` function,

```
stats:::pnorm
getAnywhere(pnorm)  

```

How can i see the source code of `pnorm`?

```
sum
 (..., na.rm = FALSE)  .Primitive("sum")
.Primitive("sum")
function (..., na.rm = FALSE)  .Primitive("sum")
methods(sum)
no methods were found

```

and, how can I see source code of the `sum` function?

Answer: 
I know this post is more that 2 years old, but I thought this might be useful to some users browsing through this question.

I'm basically just copying my answer to [this other similar question](https://stackoverflow.com/questions/13279256/how-to-find-out-which-c-file-contains-the-c-functions-of-r-internals/29696967#29696967) so that it can maybe prove useful to some R users who want to explore the C source files.

1. First, with **pryr** you can use the `show_c_source` function which will search on GitHub the relevant piece of code in the C source files. Works for .Internal and .Primitive functions.

```
body(match.call)

# .Internal(match.call(definition, call, expand.dots))

pryr::show_c_source(.Internal(match.call(definition, call, expand.dots)))

```

Which takes you to [this page](https://github.com/search?q=SEXP%20attribute_hidden%20do_matchcall%20repo:wch/r-source&type=Code), showing that `unique.c` contains the function [do\_matchcall](https://github.com/wch/r-source/blob/ec8db8be924cf4ffd49438cbca38b876c7931863/src/main/unique.c#L1261).
2. I've put together this [tab delimited file](https://gist.github.com/dcomtois/261ff939d1a1b27525f1), building on the `names.c` file and using *find-in-files* to determine the location of the source code. There are some functions that have platform-specific files, and a handful of others for which there is more than one file with relevant source code. But for the rest the mapping is pretty well established, at least for the current version (3.1.2).
```
> methods(mean)
[1] mean.data.frame mean.Date       mean.default    mean.difftime   mean.IDate*    
[6] mean.POSIXct    mean.POSIXlt    mean.yearmon*   mean.yearqtr*  

   Non-visible functions are asterisked
> mean.default
function (x, trim = 0, na.rm = FALSE, ...) 
{
    if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) {
        warning("argument is not numeric or logical: returning NA")
        return(NA_real_)
    }
    if (na.rm) 
        x <- x[!is.na(x)]
    if (!is.numeric(trim) || length(trim) != 1L) 
        stop("'trim' must be numeric of length one")
    n <- length(x)
    if (trim > 0 && n) {
        if (is.complex(x)) 
            stop("trimmed means are not defined for complex data")
        if (any(is.na(x))) 
            return(NA_real_)
        if (trim >= 0.5) 
            return(stats::median(x, na.rm = FALSE))
        lo <- floor(n * trim) + 1
        hi <- n + 1 - lo
        x <- sort.int(x, partial = unique(c(lo, hi)))[lo:hi]
    }
    .Internal(mean(x))
}
<bytecode: 0x155ef58>
<environment: namespace:base>

```