Sorry I cannot use markdown because I believe no one can reproduce the problem. I used screenshot to describe:

(A) RStudio sessionInfo before running any code.

(B) Running the codes which give wrong results (expr is 50x30 matrix)

(C) the figure return by the last for loop you see in (B), PCA gives different results every time (not flipped axes).

(D) I believe this problem is related to Rstudio, because if I used R in the terminal directly, everything is fine.

In addition, if I call sessionInfo() after running these codes, rstudio will think forever (you see a red dot on the topright of the console window). But I am not sure these two problemd are related.

RStudio is the server version 1.2.5033

what I also tried:

- If randomly delete one/a few rows/columns from "expr", the result could be correct again ...
- I try princomp function (use eigen decomposition), the result is also wrong
- deinstall and reinstall RStudio doesn't help
- I don't think is the blas/lapack problem because the code run in terminal works fine.

This is the most wired problem I've seen. What worries me is this problem doesn't give you any error message ... Has anyone seen this problem before? Or any suggestions on what I can do to get rid of the problem? Thanks a lot.