Rstudio server returns WRONG results without any message

this does seem inexplicable, I can imagine your frustrations. :frowning:
Do you have any experience using debug() or browser() type functionality to explore anomalies?
If I was in your shoes, I would attempt a debug(prcomp) and then run the script.
I just had a look now to see how gnarly it gets, and I would guess that the main 'magic' here is happening where sub function La.svd() makes a call to .Internal(La_svd(jobu, x, double(min(n, p)), u, vt))
I'd be curious if you debug(La.svd) and step through to the first internal call of La_svd. whether the same values come back, if you stop the debug, and restart the debug process again.
Like you pointed out, the randomness does seem whacky.

Its weird though because you showed in your fourth screenshot that you run fine in a pure console, and only have the issue in Rstudio IDE. and they both reference the same BLAS/LAPACK ! and I don't know what else would be relevant :thinking:

Eitherway it might be worthwhile getting the latest version of the blas/lapack that you can, just in case it was a gremlin in some interaction between Rstudio and that version of the library.

Wish you success in overcoming this