runused-functions

identify and remove unused functions in a big project


I am trying to clean the workspace in an R project because it is getting quite big in terms of funtions produced

I have checked that this can be done with the package 'mvbutils' and the function 'foodweb()', but when trying to use it I get the following errors

>library(mvbutils)
>result <- foodweb(plotting=FALSE)
>res <- sapply(rownames(result$funmat), function(n) length(callers.of(n)))
Error in fw %is.a% "foodweb" : 
  argument "fw" is absent, no omission value
>callers.of('function_name')
Error in fw %is.a% "foodweb" : 
  argument "fw" is absent, no omission value

any help?

thanks a lot in advance, Ramón


Solution

  • library(mvbutils)
    result <- foodweb(plotting=FALSE)
    res <- sapply(rownames(result$funmat), function(n) length(callers.of(n,result)))