2

I have tried to search for the source code of the interface function ".Call(C_SplineCoef,...)" that is mentioned in splinefun {stats} as follows:

z <- .Call(C_SplineCoef, min(3L, iMeth), x, y)

But could not help myself to explore it.

MM Khan
  • 203
  • 1
  • 2
  • 7
  • you could go to https://github.com/wch/r-source and search for SplineCoef , which leads to https://github.com/wch/r-source/search?utf8=%E2%9C%93&q=SplineCoef&type= ,and choosing one https://github.com/wch/r-source/blob/af7f52f70101960861e5d995d3a4bec010bc89e6/src/library/stats/src/splines.c – user2957945 May 08 '17 at 12:21
  • Thank you @user2957945. Can you please tell me how can I access the source code from within RStudio? – MM Khan May 10 '17 at 04:09
  • as far as i am aware you cant *easily*. I suppose you could download the package source, unzip, then use grep to search the files for SplineCoef. – user2957945 May 10 '17 at 11:29

1 Answers1

1

You cannot display the code directly in Rstudio; however, you can use the pryr package to automatically search the correct source file for you on github.

First, look at the source of the R function:

is.unsorted

# function (x, na.rm = FALSE, strictly = FALSE)
# {
#   if (length(x) <= 1L)
#     return(FALSE)
#   if (!na.rm && anyNA(x))
#     return(NA)
#   if (na.rm && any(ii <- is.na(x)))
#     x <- x[!ii]
#   .Internal(is.unsorted(x, strictly))
# }

and then use:

pryr::show_c_source(.Internal(is.unsorted(x, strictly)))

to automatically open a browser window to https://github.com/search?q=SEXP%20attribute_hidden%20do_isunsorted+repo:wch/r-source&type=Code

Stefan F
  • 2,573
  • 1
  • 17
  • 19