R and R studio won't load aplpack - r

I am using R/Rstudio (version 4.0.3 - "Bunny-Wunnies Freak Out") and have installed the aplpack package. However, when I go to load the package, it just loads forever without actually activating the package. I'm currently running macOS Big Sur 11.2 and I have the latest version of XQuartz installed. To load the package, I am using
library(aplpack)
I saw that someone else has had a similar problem, but they were running a different OS and their question was never answered. I'm hoping someone out there can help.
UPDATE: As was requested in the comments, here is the Sys.info() and the sessionInfo() information:
`Sys.info()
sysname
"Darwin"
release
"20.3.0"
version
"Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64"`
`sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3`

I was able to install and open the aplpack package (macOS Big Sur 11.2) using install.packages("aplpack"); library(aplpack) but it did take some time to load (~2 mins). I suspect your issue is related to xquartz. Xquartz no longer comes installed with macOS, so a likely solution to your problem is to install an up-to-date version of xquartz (https://www.xquartz.org/releases/) and ensure it can be opened from RStudio using x11()

If you want to reach the R - Mac experts,
a posting to the ("good old") R-SIG-Mac (R Special Interest Group # Mac) mailing list will reach them, notably the R Core team members involved:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Related

Why am I not having any problems with the lastest versions of R and Rstudio?

I am using the latest versions of R and Rstudio and I am doing my work exclusively on Rstudio. The info about my OS and R version:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0
More detailed info about the R version:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.0
year 2021
month 05
day 18
svn rev 80317
language R
version.string R version 4.1.0 (2021-05-18)
nickname Camp Pontanezen
In Rstudio when I go to Help > Check for Updates I get this:
Or using versionInfo:
> library(rstudioapi)
> versionInfo()[2:4] # ignoring the `$citation` which is not necessary for this question
$mode
[1] "desktop"
$version
[1] ‘1.4.1103’
$release_name
[1] "Wax Begonia"
One of the main problems that people are having is the ggplot2 related problems. Seems like people cannot produce ggplot2 plots with the newest version of R on the newest version of Rstudio. But this works perfectly fine for me. For example:
> library(ggplot2)
> ggplot(mtcars, aes(hp, mpg)) + geom_point()
Why this would be the case? And should I be worried about my current projects crashing all of a sudden and being not reproducible with the future updates?
Also, I am not sure if I should use the Preview version of Rstudio or keep using the current one in terms of my projects being safe.
This problem seems to be specific to Linux and macOS.
In this issue and all other reports of the bug I could find, Linux or macOS are specifically referenced. But there is not official confirmation, as far as I can see.
To confirm this theory then, I tested your code on my Ubuntu and Windows 10 machines: On Linux I experience the crash described in the issue. On Windows I had no problems.
As a further note, I experience this issue with your specific example but haven't noticed it since installing R 4.1.0 last week. Why? Because I rarely work with R scripts and the issue is apparently not affecting the Console or R Markdown (knitting or running just the chunk). Both have no problem running the example.
So I believe there is no need for you to update to the preview. For people on Unix systems, it looks a bit different. If you regularly use R scripts, you should consider the preview linked in the issue or switch to R Markdown.

Synchronizing R system settings from Terminal, GUI and RStudio

My problem on my MacOS is that I can use R from GUI (aka console, downloaded from CRAN), Terminal or from RStudio but I cannot have them function in the same way.
Specific example is I can use rJava on Terminal and RStudio but not on GUI. Similar stuff happens for Rmarkdown pdf outputs. I usually get errors from GUI but everything is fine on Terminal or RStudio. How do I update R GUI settings to the same as Terminal's?
ps. For instance R CMD javareconf command handled the Terminal R but not R GUI.
edit: It is not actually something that requires a minimal working example but let's try library(rJava) after installing it.
R Called from Terminal (same with RStudio)
No problems.
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0
R GUI
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0
Some differences between Sys.getenv() are GUI has the following extra
LD_LIBRARY_PATH :#JAVA_LD#
DYLD_LIBRARY_PATH /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/server
Brief update: I was able to correct Rmarkdown situation by using this link and reading help by writing ?Startup on R console. Changed the Renviron file on my R.home()/etc/. But still no rJava.
For R Markdown problem, I managed to handle it by adding a ~/.Renviron file and defining PATH parameter with the value I got from Terminal's Sys.getenv() parameters.
The only thing that worked for rJava for High Sierra is the following answer (changed the version to 3.5 though)
https://stackoverflow.com/a/47685001/3608936

R Studio package installation problems: clang version doesn't match?

I'm on a Mac OS Sierra WITHOUT admin privileges (ugh). There's a bunch of packages I really need to install, but for the vast majority, when I try to install, I get the following error:
make: x86_64-apple-darwin13.4.0-clang: No such file or directory
make: *** [base64.o] Error 1
ERROR: compilation failed for package ‘RCurl’
I have clang installed but it's a different version:
clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
I suspect this mismatch is the problem, but not being particularly savvy with installs and the innards of the computer, I really have no idea how to resolve it. I haven't been able to find a similar enough issue that someone else that that's helped my situation.
I've tried editing my path to include all the possibilities that occur to me. I've also tried installing devtools (same error, essentially). My sessionInfo() and r --version information are below.
r --version
R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
... and sessionInfo():
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2

Warning in install.packages: cannot open UR HTTP status was '404 Not Found'

When running install.packages in the latest R (3.4) and RStudio 1.0.143 I get the following warning
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
This appears no matter what package(s) I select, however this does not appear to effect package installation. I tried clearing my ~/.rstudio-desktop, /Library/Frameworks/R.framework/Versions/3.4/Resources/library and reinstalling R and this warning still persists. Evening changing CRAN mirrors appears to have no effect as a similar warning appears. Below is my session information.
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] datasets stats graphics grDevices utils methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0
Just to let people know: this issue is coming from the R-Studio IDE. It will be fixed in the newest version. For more info: see this link.
EDIT:
With the new version (1.0.153) this issue has been resolved!
As #ManualS already acknowledged this is an issue with the RStudio 1.0.143. As long as there is no fix the following workaround works fine:
Close RStudio and start base R
Install package there, either by
install.packages("packagename") or by menu "Packages/Install package(s)"
Close base R and start RStudio again
A full support session (for the OneR package) with more details can be found here: https://github.com/vonjd/OneR/issues/4

tcltk not loading and causes R-gui to become unresponsive or crash

I've run into a problem with getting tcltk to run properly on r-gui. It's a required package for one of the packages (aplpack) I'd like to work with.
Preliminary Stuff
13" Macbook Air
OSX Yosemite - Version 10.10.5
R Version 3.2.3
R.app GUI 1.66 (6956) x86_64-apple-darwin14.5.0
r and r-gui were installed via homebrew
I installed aplpack in order to use the bagplot function. Upon loading the package I received the following output:
Loading required package: tcltk 2015-12-23 09:44:11.134 R[6529:31353]
-[NSApplication _setup:]: unrecognized selector sent to instance 0x60800011b3f0 2015-12-23 09:44:11.135 R[6529:31353] ***
run_REngineRmainloop: exception -[NSApplication _setup:]: unrecognized
selector sent to instance 0x60800011b3f0 caught during REPL iteration.
Update to the latest GUI version and consider reporting this properly
(see FAQ) if it persists and is not known. Consider saving your work
soon in case this develops into a problem.
The session became unresponsive and I had to force quit.
To try and solve the problem, I checked to see if tcltk was installed:
> capabilities()["tcltk"]
tcltk
TRUE
It was also available via the package manager but trying to load it, both through the gui and using library("tcltk") caused R to become unresponsive and resulted in an identical error:
2015-12-23 09:49:24.370 R[6571:33844] -[NSApplication _setup:]:
unrecognized selector sent to instance 0x608000108f70 2015-12-23
09:49:24.370 R[6571:33844] *** run_REngineRmainloop: exception
-[NSApplication _setup:]: unrecognized selector sent to instance 0x608000108f70 caught during REPL iteration. Update to the latest GUI
version and consider reporting this properly (see FAQ) if it persists
and is not known. Consider saving your work soon in case this develops
into a problem.
Some googling led me to do the following:
uninstall r-gui via homebrew
uninstall r via homebrew
download and install the most recent version of xquartz
installed homebrew/dupes/tcl-tk (which I thought was supposed to fix the issue)
ran brew update
ran brew upgrade
ran brew doctor
installed r via homebrew
installed r-gui via homebrew
After taking the above steps, I'm still running into the same issue as before.
Here is the output of sessionInfo():
sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-apple-darwin14.5.0 (64-bit) Running under: OS X 10.10.5
(Yosemite)
locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils
datasets methods base
Following the advice in the Mac OSX FAQ (to attempt to replicate the issue), I opened the r in terminal and was able to not only load tcltk, but also aplpack:
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C)
2015 The R Foundation for Statistical Computing Platform:
x86_64-apple-darwin14.5.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY. You are
welcome to redistribute it under certain conditions. Type 'license()'
or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors. Type
'contributors()' for more information and 'citation()' on how to cite
R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help. Type 'q()' to
quit R.
sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-apple-darwin14.5.0 (64-bit) Running under: OS X 10.10.5
(Yosemite)
locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils
datasets methods base
library("aplpack") Loading required package: tcltk
sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-apple-darwin14.5.0 (64-bit) Running under: OS X 10.10.5
(Yosemite)
locale: [1]
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] tcltk stats graphics grDevices
utils datasets methods [8] base
other attached packages: [1] aplpack_1.3.0
I believe that the issue with loading tcltk is interfering with loading aplpack and that something in R.app/r-gui is not playing nicely with tcltk.
To my understanding
install.packages("tcltk")
Returns
package ‘tcltk’ is not available (for R version 3.2.3)
A work around would be to use the previous version of R which is compatible with tcltk.

Resources