running R script from another script - problem with source()

hi!

I would like to run few script using one script (I don't want to run particular scripts separably).

I've tried to use function source() but I got a java error ("JAVA_HOME cannot be determined from the Registry"). I installed Java and external scripts ran when I used source(), but there I had different problem with imported scripts.

After installing Java function createworkbook() works in some different way and it destroy whole my code. Before installing Java these function and whole script worked properly.

And there is my question: how can I run few scripts using another script (source() without Java installing or some different way?)

source() is not related to Java, most likely some of the scripts you are sourcing loads a library that depends on Java, I'm guessing you are loading a package to create xlsx files so maybe you could try replacing it with another one that doesn't depend on Java, like openxlsx package.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Yes, it could be the key problem with using source().
Is there some other way to handle with it, maybe different function similar to source()?

I ask because if I decide to change these package I will need to modify about 40 scripts...

I guess this is not a problem of using source(), but a problem between the Java dependent package you are using and your Java installation. In my opinion the best solution is andresrcs': replace the package you are using with one that doesn't depend on Java.

If there are reasons not to do this:
Have you searched the internet for this error message and tried the suggested solutions?