error duirng loading "xlsx" library in R - r

I got the following errors after installing and require the xlsx library in R:
> install.packages("xlsx")
trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/contrib/3.0/xlsx_0.5.5.tgz'
Content type 'application/x-gzip' length 395421 bytes (386 Kb)
opened URL
==================================================
downloaded 386 Kb
> require(xlsx)
Loading required package: xlsx
Error : .onAttach failed in attachNamespace() for 'xlsx', details:
call: .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")
error: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject
Tried and hunted around and can't figure out the problem. Does anyone know what the problem is?

The xlsx package doesn't support the latest Mac R version 3.01 & 3.02 but it works well under R 3.0. Use gdata::read.xls is recommended if so.

Related

Package ‘adegenet’ version 2.1.4 cannot be unloaded in R

I am trying to use a function in the R package adegenet
It seems like it will install fine, but then when i call the package i get an error.
> install.packages("adegenet")
Installing package into ‘/Users/j2/Library/R/4.1/library’
(as ‘lib’ is unspecified)
trying URL 'https://mirrors.nics.utk.edu/cran/bin/macosx/contrib/4.1/adegenet_2.1.5.tgz'
Content type 'application/x-gzip' length 2830546 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
The downloaded binary packages are in
/var/folders/p9/cy6q_pk935z1dfplsjrts30h0000gr/T//RtmpZXEMHg/downloaded_packages
> library(adegenet)
Error in value[[3L]](cond) :
Package ‘adegenet’ version 2.1.4 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘adegenet’ is imported by ‘adephylo’ so cannot be unloaded
I'm not sure if the problem is with the install or calling the library. Any advice would be appreceated.
Thanks!

Error downloading tidycensus library in R

I am trying to use the census_api_key() function in tidycensus, but keep getting an error that it can't be found, nor does it seem like the tidycensus library is being installed properly according to the error messages I am receiving.
Here is what I've done so far:
> install.packages("tidycensus")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/matia/OneDrive/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/tidycensus_0.11.4.zip'
Content type 'application/zip' length 2683556 bytes (2.6 MB)
downloaded 2.6 MB
> library(tidycensus)
Error: package or namespace load failed for ‘tidycensus’:
object ‘is_present’ is not exported by 'namespace:lifecycle'
In addition: Warning message:
package ‘tidycensus’ was built under R version 3.6.3
> census_api_key("my key")
Error in census_api_key("my key") :
could not find function "census_api_key"
I've also tried installing the rgdal library, as was suggested for other tidycensus errors, but this hasn't worked for me.
Any suggestions are greatly appreciated.

Rcmdr error when loading in OSX Yosemite

I'm trying do load Rcmdr and keep getting an error message.
I'm using Rstudio Version 0.98.1091 on a OSX Yosemite operating system.
I have done the following:
install.packages("Rcmdr")
trying URL'http://cran.rstudio.com/bin/macosx/mavericks/contrib/3.1/Rcmdr_2.1-5.tgz'
Content type 'application/x-gzip' length 5342987 bytes (5.1 Mb)
opened URL
==================================================
downloaded 5.1 Mb
However, when I try to load it, I get the following error:
> library(Rcmdr)
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich
Error : .onLoad failed in loadNamespace() for 'Rcmdr', details:
call: structure(.External(.C_dotTclObjv, objv), class = "tclObj")
error: [tcl] invalid command name "tk_messageBox".
In addition: Warning message:
In fun(libname, pkgname) : couldn't connect to display ":0"
Error: package or namespace load failed for ‘Rcmdr’
I have already installed X11 and it still doesn't work.
I had this same issue-- but it ended up working fine as long as I had X11 running prior to opening R. Now it works fine. See if that works!

Error running RNetCDF library in R

I'm having difficulty installing this R package. It seems to install, but then fails to run with the following error. The type='source' also fails. Any idea what's going wrong?
> install.packages('RNetCDF')
Installing package into ‘/Users/robinedwards/Library/R/3.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.ma.imperial.ac.uk/bin/macosx/mavericks/contrib/3.1/RNetCDF_1.6.2-3.tgz'
Content type 'application/x-gzip' length 2112407 bytes (2.0 Mb)
opened URL
==================================================
downloaded 2.0 Mb
The downloaded binary packages are in
/var/folders/_s/ppznw4sx7p51kwv__hj3d8540000gn/T//RtmptxKC3g/downloaded_packages
> require(RNetCDF)
Loading required package: RNetCDF
Error : .onLoad failed in loadNamespace() for 'RNetCDF', details:
call: NULL
error: I/O error (udunits)
The problem appears to be udunits2, which RNetCDF uses and ncdf does not. Specifically
>> --with-udunits-lib='/soft/local/udunits-2.1.23/lib'"
is that path in the ld.so cache or in LD_LIBRARY_PATH? If not, it will not be found by dlload.
I actually found several threads about this error and every one of them involved Mac OS X. Is that what you're running?
Source: https://stat.ethz.ch/pipermail/r-help/2011-September/289074.html

How to install RtidyHTML on Mac?

Any ideas how I can install RTidyHTML when I get the following error message?
install.packages("RTidyHTML", repos = "http://www.omegahat.org/R", type="source")
trying URL 'http://www.omegahat.org/R/src/contrib/RTidyHTML_0.2-1.tar.gz'
Content type 'application/x-gzip' length 554953 bytes (541 Kb)
opened URL
==================================================
downloaded 541 Kb
* installing *source* package ‘RTidyHTML’ ...
./configure: line 3: make: command not found
ERROR: configuration failed for package ‘RTidyHTML’
* removing ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML’
You need to install XCode on your Mac if you want to compile from source. (Roman's comment only applies to Windows machines.) I just tried installing it on an XCode-equipped Mac running R 2.13.0 and get first a warning during compliation
ld warning: in libtidy/libtidy.a, file is not of required architecture
installing to /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64
... and then get an error during the test load that is part of the install script:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so, 6): Symbol not found: _tidyBufFree
Referenced from: /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RTidyHTML/libs/x86_64/RTidyHTML.so
Expected in: dynamic lookup
I suppose it is possible that it may compile under a 32 bit version of R on the Mac.64-bit. See Simon Urbanek's web page: for more specifics and some installers for other packages.
EDIT: Installation while running 32bit R from the GUI was successful with a current R (version 2.13.1 RC (2011-07-03 r56263) )

Resources