2

I am trying to use 'rfe' function from 'caret':

lmProfile <- rfe(x=trainData[, 0:(ncol(trainData)-1)], y=trainData$target,
             sizes = subsets,
             rfeControl = ctrl)

but I get the following error:

Error: package e1071 is required

I am running my code in Jupiter Notebook. I've installed both 'caret' and 'e1071' packages:

install.packages('e1071', dependencies=TRUE)
install.packages('caret', dependencies = TRUE)

I also tried the following in the terminal:

conda install -c r r-e1071 
conda install -c conda-forge r-e1071 
conda install -c conda-forge/label/gcc7 r-e1071 
conda install -c conda-forge/label/cf201901 r-e1071 
conda install -c conda-forge/label/cf202003 r-e1071

I always got the same error message.

Any suggestions?

eli-k
  • 10,898
  • 11
  • 40
  • 44
Vivi
  • 21
  • 1
  • 4
  • 3
    Have you tried ```library(e1071)```? Running library(package_name) is required to load installed packages. – Jamie_B Apr 21 '20 at 15:41
  • HI Jamie_B. Here what I get running the following `install.packages("e1071", dep = TRUE, type = "source")` `Warning message in install.packages("e1071", dep = TRUE, type = "source"): “installation of package ‘e1071’ had non-zero exit status”Updating HTML index of packages in '.Library' Making 'packages.html' ... done` `library(e1071)` `Error in library(e1071): there is no package called ‘e1071’` – Vivi Apr 21 '20 at 16:33
  • you failed to install e1071.. and can you include the error message above – StupidWolf Apr 21 '20 at 17:55
  • 1
    Seems to be that gcc is not installed in your Anaconda environment, which is needed for the e1071. You can either try and install it or just download RStudio directly outside of Anaconda and then install e1071 – Jamie_B Apr 21 '20 at 18:01
  • I tried to install gcc typing `conda install -c conda-forge gcc ` in the terminal (got a long list of conflicts). This didn't solve the problem. I am currently trying to create the confusion matrix for logit regression or for Random Forest, but I still get the same error `Error: package e1071 is required`. Any further ideas? – Vivi Apr 25 '20 at 14:51
  • this has to do with how your conda is installed and how you install r using conda. First of all, are you using Rstudio, or anaconda R ? and which R is your RStudio using? – StupidWolf Feb 24 '21 at 13:45

0 Answers0