How to install the e1071 package in R 2.15.0 - r

I want to use the skewness() and kurtosis() functions from the e1071 package. I have tried downloading the e1071 package with
install.packages("e1071", dep = TRUE)
but it still doesn't seem to work. So I am wondering if it is the wrong version I installed. I've tried searching the CRAN site but I can't seem to find the version for R 2.15.0.
So I was wondering if I was doing it wrong or could someone please give me the link to the e1071 package, version 2.15.0.

You could try this:
go to the
https://cran.r-project.org/web/packages/e1071/index.html
get the windows Finding the windows binary filebinaries for the library and put it in your library folder within the R installation. Then load the library within R
library(e1071)
:)

Well I did like this
if you are using Rstudio
go to packages in the right windows
click on install
write e1071
click install and it will work

In R (for OSX) select Packages & Data -> Package Installer from the menu. If you haven't already select a Datacenter.
Then you can search for the package and install it via Install selected
Then you can use the package via:
> library(e1071)

This is how I did it for mac:
1) Download the binary - https://CRAN.R-project.org/package=e1071
2) Run R CMD INSTALL e1071_version.tgz
After this i tried to load the library but ran into the following problem. If you don't you can skip the step below.
Error: package or namespace load failed for ‘e1071’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/ME/anaconda3/lib/R/library/e1071/libs/e1071.so':
dlopen(/Users/ME/anaconda3/lib/R/library/e1071/libs/e1071.so, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libR.dylib
Referenced from: /Users/ME/anaconda3/lib/R/library/e1071/libs/e1071.so
Reason: image not found
3) Copy /Users/ME/anaconda3/lib/R/lib/libR.dylib /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libR.dylib
A soft link might work as well but i just copied the whole lib.

Related

Fail to load libraries after upgrading R to 3.6.0 on Mac

I needed to install the R package quadprog, which only works for R with version 3.6.0. So I installed R (3.6.0 version), and open it with RStudio. But now I failed to load any libraries, even after I installed the packages successfully using install.packages("package_name"). Specifically, the libraries I need to load are caret, forecast and ggplot2. I tried re-installing R but it still does not work. The error message I get is
Error: package or namespace load failed for ‘forecast’ in
dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so,
6): Symbol not found: ___cxa_uncaught_exceptions Referenced from:
/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
Expected in: /usr/lib/libc++abi.dylib in
/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
After installing Rcpp package successfully with install.packages("Rcpp") , I still got the message above when I tried library(Rcpp). So I am completely stumbled here...(before upgrades, everything works fine except I cannot install quadprog, so cannot install forecast package as well). Can anyone please help me fix this issue?
Please see below the images showing that the packages are stored in the same directory path of the R.
I read that you need to recompile your old packages after upgrading to newer version of R. Run the following line in your R terminal
update.packages(ask=FALSE,
checkBuilt=TRUE,
repos="https://cloud.r-project.org")
Then
install.packages(c("Rcpp", "caret", "forecast", "ggplot2", "quadprog"),
dependencies=TRUE,
repos="https://cloud.r-project.org")
Had similar issue, restart R session and install Rcpp from source
install.packages("Rcpp", type="source")
then load the library
library(Rcpp)
if still getting the error, restart R session and try loading library again.
I ended up by getting and then google searching the exact error code :). I fixed it by installing the latest version of R from CRAN along with the latest version of Rstudio. What I think happened was that when I updated some packages R and Rstudio were out of sync.

NLoptr failed to install on Mac: unable to load shared object

I'm trying to install the package nloptr on Mac OS High Sierra in order to use many nice packages like lme4, and I'm using RStudio inside Anaconda, with R 3.4.2. I have also installed NLopt (downloaded from the NLopt website, not the development version. I have also installed Xcode command line tool. But I still can't install nloptr, and get this
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so':
dlopen(/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so, 6): Symbol not found: _nlopt_add_equality_mconstraint
Referenced from: /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
Expected in: flat namespace
in /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
I already searched online for what to do, and did add the path where NLopt was installed to LD_LIBRARY_PATH in the /etc/ldpaths file, but I still get the same error. Yes, I have the same problem as in Trouble installing nloptr package on R 3.3.0, but I didn't find a solution that works there since the person who asked that question resolved it himself and I don't know what he meant when he said "installed as a root". Can anyone help?
Also, I got something like this when installing NLopt with CMake, and this happened to many different functions:
In file included from f77api.c:103:
./f77funcs.h:57:14: warning: 'nlopt_minimize_constrained' is deprecated
[-Wdeprecated-declarations]
*info = nlopt_minimize_constrained((nlopt_algorithm) *algorithm,
^
./nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked
deprecated here
int maxeval, double maxtime) NLOPT_DEPRECATED;
^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
# define NLOPT_DEPRECATED __attribute__((deprecated))
^
Would this be why the library isn't loaded?
BTW, I have installed Rcpp and updated it. Rcpp works on my computer.
Update: I changed the default C and C++ compiler to clang4 downloaded from R project. I tried the installation again, and got a different error:
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so':
dlopen(/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so, 6): Library not loaded: #rpath/libnlopt.0.dylib
Referenced from: /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
Reason: image not found
Error: loading failed
I have tried to tell R where the library is by Sys.geteng(DYLD_LIBRARY_PATH = "/usr/local/lib"), but it didn't work. It actually appears that R does know where the shared library is, according to the messages I got from installation, but it just can't load it. Please help!
Never mind, I reinstalled Anaconda, and installed the standalone R and RStudio (not within Anaconda), and those packages all installed successfully. Maybe it's a bad idea to use the RStudio inside Anaconda.
Edit: For those who run into similar scenarios: I switched to Microsoft R Open (MRO), since I'm dealing a lot with linear algebra recently. Then when I tried to install nloptr in MRO, I got a similar error message that shared library failed to load because image not found. I reinstalled the CRAN R 3.4.3 and nloptr installed totally fine there. So I found where nloptr was installed in CRAN R 3.4.3 by .libPaths(), copied the nloptr folder to where MRO stores packages, and used the utility RSwitch to change the default version of R to MRO. Then I loaded nloptr in MRO, installed packages that depend on it, and used those packages; they worked fine. I don't know what's wrong with MRO that caused the error, but at least this worked.

Trying to install library 'quantmod' in R

I'm trying to download library 'quantmod' in R:
install.packages("quantmod")
console:
The downloaded source packages are in
‘/tmp/RtmpwSKGIl/downloaded_packages’
then:
library("quantmod", lib.loc="/tmp/RtmpwSKGIl/downloaded_packages")
console:
Error in library("quantmod", lib.loc = "/tmp/RtmpwSKGIl/downloaded_packages") :
there is no package called ‘quantmod’
What is the problem?
I get no problem when I try to load this package.Have you tried to provide R the full name path to your package file directory ?C:/Users/...Is your R version up to date ? Try to check if you have the latest, I tried and it worked with :
R 3.3.3
If you are a Windows or MAC user you might want to force the download of the package from source to binary, this can be done by setting the right options in the install.packages command:
options(install.packages.check.source = "no")
https://stat.ethz.ch/R-manual/R-devel/library/utils/html/install.packages.html
I guess I am a year late, but just got out of this situation by installing the Package from R (instead of RStudio) by changing the CRAN.
You can then run library(quantmod) in Rstudio. Hope this works(worked?) for you too.
I am ready to go now!

Car package not found by R (failed to load)

I am am trying to load a simple dataset using:
library(car)
but I get the following error:
Error in library("car") : there is no package called 'car'
Does anyone have an idea why this happens and how to solve it?
If you don't currently use an IDE (or even if you do), the following will install the package:
install.packages("car")
Before then running
library("car")
You should heed #Iris's advice and use a RStudio if you don't already to manage just this sort of task.
You forgot to install the package before you tried to load it.
Do you use a IDE (integrated development environment)? I can strongly recommmand the use of Rstudio as IDE.
When you installed Rstudio, you can choose in the toolbar: "Tools" > "Install packages..."
Type in "car" and click "install".
As soon as the package is installed, you can load the package with library(car)
I know this post was from several months ago, but I came across it after having the same issue. I followed the instructions here (it's a .doc download).
I typically use R Studio, but was having no luck with this:
install.packages("car")
I opened the R application (not Studio) and followed the instructions on the .doc. I now have the package. Good luck!
For security purposes, I use R in a standard account on a Mac and download packages via a separate admin account. Yesterday I updated Microsoft R Open from 3.2.2 to 3.2.3 and I got this message when I tried to load Rcmdr:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘nlme’ 3.1-122 is being loaded, but >= 3.1.123 is required
Error: package ‘car’ could not be loaded
I had to log in to my admin account and check for updates. There was one for nlme, that I installed and that allowed car to load.
This worked for me. After downloading the most stable version of R (3.4.4), first, I install.packages("car",dependencies=TRUE) then install all the packages that when loading car I was asked for like haven, foreign, etc. So I installed them separately. Also, I noticed that when I install the packages they go to win-library folder instead of the actual working folder (the packages go to R\win-library\3.4 instead of R\R-3.4.4. So I copied them to the right folder.
I used Tools/Install packages... from R Studio and chose not to compile from source and do this for several packages it complains missing. And it works!

Error while installing R package: package built for universal-apple-darwin

I installed a R package as suggested by How do I install an R package from source?, using R CMD INSTALL [my_pkg_path.tgz]. Package sources are downloaded from r-project.org, e.g., http://cran.r-project.org/web/packages/fields/index.html
However, when I try to load the package using say library(fields), I got the error that complains the package are built for universal-apple-darwin:
Error: package ‘fields’ was built for universal-apple-darwin9.8.0
Guess it's something to do with architecture, but no idea how to resolve it. Any idea? Thanks.
It looks like you downloaded the package's Mac OSX binary file, which usually ends in .tgz - try downloading the package source (usually something ending in .tar.gz) and installing the package again.
Depending on what your operating system is, you may need an additional set of software before you can install packages from source. If the above suggestion doesn't work, would you provide some information about the OS, for example from sessionInfo()?

Resources