DEV Community

loading...

[Solved] R doesn't find installed packages

iepsenn profile image Lukas Iepsen ・1 min read

I started with the R language today, but I had some problems installing packages.
To illustrate my problem, I will try to install the ggplot2 package with the command

install.packages("ggplot2")

After executing this command, this message appears

Alt Text

That sounds good to me, but when I try to import this module

Alt Text

I think this error occurred due to the multiple locations for the library paths

Alt Text

But I tried to install in all these paths and the error continues

install.packages("ggplot2", lib=`libpath`)

I also tried to install on RStudio

Alt Text

Alt Text

But errors continued...

Alt Text

I've never worked with R before, so does anyone have any ideas to avoid these mistakes?

System Infos

  • OS: Linux Mint 19.3
  • Kernel: Linux 5.0.0-32-generic
  • Architecture: x86-64
  • R Version: 3.6.3
  • RStudio Version: 1.2.5033

Discussion (3)

pic
Editor guide
Collapse
daveparr profile image
Dave Parr

Glad you solved it :)

Incidentally, non-zero exit status actually tends to mean something didn't work.

In R we have a few tools available to us to manage packages in addition to the built in ones. Packrat has been a default solution for a long time, but now I think renv is going to soon replace it.

Any idea why the apt install build-essential solved it? I guess it might be as you needed to do local builds from the source code as opposed to pulling a new tarball in?

Collapse
iepsenn profile image
Lukas Iepsen Author

I'm going to guess this installs the GCC toolchain which R would need to compile those packages for my distro since CRAN does not provide binary packages for linux...

Collapse
iepsenn profile image
Lukas Iepsen Author

The command apt install build-essential solved this.