Skip to content

Instantly share code, notes, and snippets.

@romainfrancois
Created February 17, 2014 16:38
Show Gist options
  • Save romainfrancois/9054080 to your computer and use it in GitHub Desktop.
Save romainfrancois/9054080 to your computer and use it in GitHub Desktop.
Show what's in .Internal function
library("httr")
library("rjson")
internal <- function(fun){
names.c <- content( GET("https://raw2.github.com/wch/r-source/trunk/src/main/names.c") )
names.c <- strsplit( names.c, "\\n" )[[1L]]
rx <- sprintf('^[{]"%s"', fun )
match <- grep( rx, names.c)
if( length(match) != 1L ){
stop( "did not find a single match" )
}
data <- strsplit( names.c[match], "[[:space:]]*,\\t[[:space:]]*" )[[1L]]
impl <- data[2]
url <- sprintf( 'https://github.com/search?q="SEXP attribute_hidden %s"+repo:wch/r-source&type=Code', impl)
BROWSE(url)
}
# example use
internal( "is.vector" )
@hadley
Copy link

hadley commented Feb 17, 2014

Would you mind if I included this in pryr?

@romainfrancois
Copy link
Author

Sure. This has not been thoroughly tested though.

@romainfrancois
Copy link
Author

Just for the record if anybody comes back here. pryr now has this:
https://github.com/hadley/pryr/blob/master/R/names_c.R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment