-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This is the use case I mentioned at the RStudio conference. I'd like to find functions called as arguments in apply functions or in something like switch()
file_lines <- "
sapply(mtcars, min)
agg <- function(x, fun) {
fn <-
switch(
fun,
avg = mean,
total = sum
)
fn(x, na.rm = TRUE)
}
agg(1:3, 'total')
"
file_output <- tempfile(fileext = ".R")
writeLines(file_lines, file_output)# A tibble: 4 x 2
funs pkgs
<chr> <chr>
1 sapply base
2 switch base
3 fn (unknown)
4 agg (unknown)
I am expecting to see min, mean and sum in the mix
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels