0

In rStudio, I can go to definition.

But In R console how can I find location with code?

> show_somewhat_location_of_function(dplyr::src_dbi)

I see that I can view source code in REPL. But How can I get Location of function?

file: some_x.R
line: 42
ruseel
  • 1,578
  • 2
  • 21
  • 41

1 Answers1

1

I believe src_dbi is a function from dbplyr and not dplyr.

To get the definition of that function (or the code of that function), just type the function with the brackets so they're not treated as a function call:

dbplyr::src_dbi

And R output:

function (con, auto_disconnect = FALSE) 
{
    if (is_false(auto_disconnect)) {
        disco <- NULL
    }
    else {
        disco <- db_disconnector(con, quiet = is_true(auto_disconnect))
    }
    structure(list(con = con, disco = disco), class = c("src_dbi", 
        "src_sql", "src"))
}
<environment: namespace:dbplyr>

Which tells me the namespace and the definition of that function.

onlyphantom
  • 8,606
  • 4
  • 44
  • 58