Issue with installed.packages

package-installation

#1

Hi there,

I have been receiving error msg installing packages. Everytime I run a code it says "Updating Loaded Packages - One or more of the packages that will be updated by installation are currently loaded. Restarting R prior to updating these packages is strongly recommended" and if I click "yes" to it, it goes into a loop. If I decide to skip that code chunk and try run the next code, it gives me error msg saying that it "cound not find function.."

#installing packages
install.packages("ggplot2") 
install.packages("knitr")
install.packages("gridExtra")
install.packages("plyr")
install.packages("dplyr")
library(ggplot2)
library(GGally)
library(gridExtra)
library(dplyr)
library(plyr)
library(memisc)

#removing column X from rwq data
rwq = select(rwq, -1)

#2

You're likely getting this error because you can't attach a library that you haven't installed. The functions are inside of the library, so you'll need to make sure the install succeeds. Try installing the packages in a fresh session.


#3

Hi mara,

Thanks for getting back. I re-installed R studio, opened the file and tried installing the packages but still no luck.

It keeps going into this loop:

Restarting R session...

install.packages("ggplot2")
Error in install.packages : Updating loaded packages

is there any issue with my code for not able to install packages or is it something else?

Many thanks,


#4

I find that restarting R from this dialog box does not always do the trick. I recommend hitting "Cancel" and then using the keyboard shortcut Ctrl + Shift + F10 to restart your R session. Then retry installing the package.


#5

Right, so you'll have a clean session. You might also want to close out of your .Rmd if you're installing knitr. This could be just a coincidence from one time I was having problems, but I can't imagine it hurts to do.


#6

Thanks tbradley and mara i followed both of your advices and now it is installing those packages.

mara - why is it best to close out .rmd when installing knitr?


#7

As I said, I'm honestly not sure if that's a real thing or if it's correlation/superstition.


#8

Hi, @anapy, recently I used to fail to install ggplot2 package with newest version. Here is my general way to fix problem about installling packages (I post here and copy it).

  • In the console, type .libPaths() or find.package (@cderv) and get the package path in your computer.
  • Go to the path and delete the package folder
  • Reuse install.package() function to try.

If in this way, it also fail. I suggest you can install this package from github in the developing version.


#9

Some RStudio IDE feature and UX are build upon some R :package: . It is why you need them, and they can be loaded just because the IDE is open. I observed this with yaml :package: once, that is use to load the list of Rmd templates available in one of the menu.
It may be the case for knitr: This :package: is the foundation for Rmd functionnality and it is possible the Rmd feature in the IDE are built upon knitr being loaded. Not sure but possible.

In all case, one safest way to update all your packages could also be to not open RStudio for that. You open R GUI or just R at command line and run update.packages() there - nothing is loaded and no risk a conflict.


#10

Thanks all! It is working now - much appreciated!


#11

Hi everyone,

This could be related to my previous post so I am adding this query here.

I successfully installed packages mentioned previously (except 'knitr') and the code runs without any problem but when I click command for 'knit HTML' , I get this error -


I checked the file location .libPaths(), plyr dplyr and memisc packages are now turn into .dll only. Do you think this is the problem? If so how can I fix it?

Thanks in advance.