lewinfox / foodwebr

Function dependency graphs in R
http://www.lewinfox.com/foodwebr/
Other
20 stars 2 forks source link

Identifying functions used via `do.call` #5

Open iagomosqueira opened 1 month ago

iagomosqueira commented 1 month ago

A function called inside another using do.call does not appear to be identified. Is this expected?

Could foodweb() be made aware of this without too much work?

Our code has instances of do.call dispatching on both character and function objects.

lewinfox commented 1 month ago

Hi @iagomosqueira, thanks for this. This is expected but not desirable - the code does not currently look for do.call() but it ought to!

It's been a while since I looked at the parsing code but I will try and find time soon. If you would like to take a crack at implementing it yourself I would welcome a PR, the relevant code is in functions_called_by(): https://github.com/lewinfox/foodwebr/blob/6f096aa5ea23e5a328588438e9608e3506588730/R/function-matrix.R#L66.

All the function names are interpreted as text for matching purposes so do.call("foo") and do.call(foo) should both be handled fine.