As part of my studies I want to run the "scagnostics"-function from the R-Package scagnostics on the Boston housing data from the package "MASS". My code amounts to
which should install and load all necessary packages. When running the function my R occasionally crashes, which I figured must have something to do with the version of Java i have running on my Mac. After installing Java and running scagnostics(Boston) through my terminal as a cross-check (which worked seemlessly), my RStudio seemed to still have the same problem.
There were two other outcomes, where I either got the initial output of scagnostics(), with RStudio crashing in the subsequent handling, or an error, that still pointed to some Java problem. See in the code below
> scagnostics(Boston)
# The Output:
#Error in .jcall("scagnostics/Main", "[[D", "computeScagnostics", data, :
# java.lang.NullPointerException
Java Version: 11.0.25
Mac-Book Pro M3 with macOS Sonoma 14.4
Can somebody maybe help me, or has someone run into the same/a similar problem! Thanks in advance!
I don't think I'm likely to be of any help but is this all the code you are running in a new session? I just want to check that there is no conflicting variable in your workspace.
Thanks for the quick reply; while the "restore .RData" option was indeed ticked, I have unticked it, cleared my workspace of all objects and inserted the code into a new R Script. Unfortunately the problem still kept occurring.
I think it likely has to do with the Java-Compilation of the scagnostics package, but it perplexes me why it runs smoothly in my Terminal then.
Just on general principles, it is a good idea to leave the "restore .RData" option unticked but if everything in running smoothly in the Mac terminal I suspect it is an RStudio problem though it could be a Java problem or a conflict with Java.
Are you running the most recent version of RStudio? If so you might want to revert one version and see what happens.
I have no problem with your code with Ubuntu 22.04, RStudio 2024.07.0+330 "Cranberry Hibiscus" and R version 4.4.1.