Apologies for not being able to generate a reprex, due to limitations in the current system
I am facing a situation in which we have had to copy-paste packages from one system to another while ensuring the same package and R versions. And I am loading all required tidymodels packages step by step, as:
However, when I try to run tune_grid() from the tune package, a part of the function fails to execute.
Debugging it, I realised the required_packages function was not running correctly, giving the error message no applicable method for 'required_pkgs' applied to an object of workflow.
I cannot get around figuring out how to resolve this as the code works completely fine in old environment, but some hypotheses I am considering are:
Does the order in which I load packages matter?
Can I somehow edit the actual function to force it to "identify" the required packages for a workflow object
To start with a clean environment, unload all packages (except the base ones), and then run the script again (previously, I was restarting R, but realised not all packages are unloaded with it)
I have tried checking the following hypotheses but to no avail:
Manually adding a default library to the .libPaths
Clearing environment and detaching all packages to start from a clean slate
Ensuring that the generics package is loaded and the function recognised by the system, only for it to fail when it is called from within the tune_grid function
Manually changing the function with assignInNamespace("required_pkgs", my_func, ns = "generics")
If anyone has a clue, or a suggestion for me to add to my hypotheses, I will be very thankful