Created
February 17, 2014 16:38
-
-
Save romainfrancois/9054080 to your computer and use it in GitHub Desktop.
Show what's in .Internal function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ) |
Sure. This has not been thoroughly tested though.
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
Would you mind if I included this in pryr?