3
votes

I am working with the earlywarnings package, and would like to edit one of the functions written in the qda_ews function. I could do fix(...) but the function I would like to edit is for some reason not listed when I use fix.

The function is called generic_RShiny. Here is the link to the github (https://github.com/earlywarningtoolbox/earlywarnings-R/blob/master/earlywarnings/R/qda_ews.R).

How can I access the entire qda_ews.R code to make the changes I need?

1
You can get the function code with getAnywhere(generic_RShiny). To edit it, you could paste it into a R script file, make your edits, assign it to a new object (like my_generic_RShiny) then run your new version of the function.eipi10
If you want to have the edited function available in the future, you could either save the script of the edited function and then source it when you need it, or you could create your own version of the earlywarnings package with the edited version of the function and then install/load your custom version of the package.eipi10
Seems like part of the problem may be generic_RShiny is not exported; have you tried appending earlywarnings:::generic_RShiny to your approach using fix?MichaelChirico

1 Answers

3
votes

once the library is loaded, use

trace(name_of_function, edit = T)

but beware that the function will be modified permanently (until of course you reinstall the package)