Problem in calling the function panelvar from the library after being installed - r

I was working with the panelvar package, that I have installed today.I created a new R script, and ran library(panelvar) and got the following error:
library(panelvar)
Error: package or namespace load failed for ‘panelvar’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘hms’
In fact, I had already installed the package:
install.packages("panelvar")
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/
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/panelvar_0.5.2.zip'
Content type 'application/zip' length 2565900 bytes (2.4 MB)
downloaded 2.4 MB
package ‘panelvar’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\JSamridhi\AppData\Local\Temp\Rtmp0GEDNw\downloaded_packages
When I try uploading the package, I get the same error again. I tried deleting the file from the library using .libpath and reinstalled the whole thing but its just not working.

Related

Unable to load packages after updating Rstudio

I recently updated Rstudio to the latest version, but am now getting continuous error messages when I attempt to use install.packages and library().
Below is an example of what I'm seeing:
> install.packages("tidyverse", type="binary") ## Basic data manipulation
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/
trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.2/tidyverse_1.3.2.zip'
Content type 'application/zip' length 428925 bytes (418 KB)
downloaded 418 KB
package ‘tidyverse’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\King Awesome\AppData\Local\Temp\RtmpaU0srW\downloaded_packages
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘cli’ 3.3.0 is already loaded, but >= 3.4.0 is required
In addition: Warning message:
package ‘tidyverse’ was built under R version 4.2.2
I'm pretty certain the issue has to do with my current working directory and library paths not matching, but I do not want to start making major changes without the advice of more experienced R users for fear of making the situation more complex.
> getwd()
[1] "C:/Users/King Awesome/Documents/Cyclistic Raw Data/Cyclistic Slice/Cyclistic Final 10 13/Cyclistic Final PT 10 13"
> .libPaths()
[1] "T:/Gaem/R-4.2.1/library"
It looks like the solution was a full wipe. I removed all installed packages, reinstalled and now have functionality again. Good solution, #PavoDive

Install and use pcalg in R on Mac M1 from Terminal

I am trying to install and use pcalg (details) in R (R-4.2.1-arm64.pkg) from terminal using the following commands:
install.packages("pcalg", dependencies = TRUE)
library(pcalg)
I get this error after the second step:
Error: package or namespace load failed for ‘pcalg’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘graph’
The first command gives the following message:
Warning: dependencies ‘graph’, ‘RBGL’, ‘Rgraphviz’ are not available
trying URL 'https://cloud.r-project.org/bin/macosx/big-sur-arm64/contrib/4.2/pcalg_2.7-7.tgz'
Content type 'application/x-gzip' length 6500355 bytes (6.2 MB)
==================================================
downloaded 6.2 MB
The downloaded binary packages are in
/var/folders/2b/q__z5z855qq_36mk8xf33b380000gp/T//RtmpVzspPi/downloaded_packages
Is there any missing step here? I want to eventually do this through rpy2 for python.
Looking at the package's CRAN page I see that graph, RBGL and Rgraphviz are not on CRAN but on Bioconductor. You need to install them with the BiocManager.

ggpmisc Error: package or namespace load failed for ‘ggpmisc’

I am trying to use the library ggpmisc and even though the installation went okey it gives me an error when I try to open the library. How can I solve it?
install.packages("ggpmisc")
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/
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ggpmisc_0.4.5.zip'
Content type 'application/zip' length 1349360 bytes (1.3 MB)
downloaded 1.3 MB
package ‘ggpmisc’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\dkafe\AppData\Local\Temp\Rtmpkh620g\downloaded_packages
library(ggpmisc)
Error: package or namespace load failed for ‘ggpmisc’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘conquer’ In addition: Warning message:
package ‘ggpmisc’ was built under R version 4.1.3

Cannot remove prior installation of package, but package not found

I have been installing packages into R since the day I downloaded it. Version 3.4.1. Today it gave me an issue when I tried to install a new package, SLOPE that had me update and reboot R. I said okay. However, in doing so I then went to call packages using the library and it told me:
> Error: package or namespace load failed for ‘plyr’ in loadNamespace(j
> <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there
> is no package called ‘Rcpp’
I have clicked around on here and it looks like I need to download and install the Rccp package. I tried that and got this answer:
install.packages("Rcpp") Installing package into ‘\tgdcfs01/Users/jsmith/Documents/R/win-library/3.4’ (as ‘lib’ is
unspecified) trying URL
'https://mran.microsoft.com/snapshot/2017-09-01/bin/windows/contrib/3.4/Rcpp_0.12.12.zip'
Content type 'application/zip' length 3319164 bytes (3.2 MB)
downloaded 3.2 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked Warning in
install.packages : cannot remove prior installation of package
‘Rcpp’
The downloaded binary packages are in
C:\Users\jsmith\AppData\Local\Temp\RtmpYHBW2f\downloaded_packages
So then I tried uninstalling Rccp and got this message:
remove.packages(Rcpp)
Error in remove.packages : object 'Rcpp' not found
What am I missing?
In order to fix it, I in fact did not update R in the first place. I needed to do the following:
install.packages("installr")
library(installr)
updateR()
Then I updated R, but I did not use the recommended setting of using R Gui. Then I was able to re-install packages and go from there.

Can't load library R Studio

I am trying to install the ggmap library:
install.packages("ggmap")
library(ggmap)
This is what I get though:
Installing package into ‘my path’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/ggmap_2.6.1.zip'
Content type 'application/zip' length 4563151 bytes (4.4 MB)
downloaded 4.4 MB
package ‘ggmap’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
my path
> library(ggmap)
Error: package or namespace load failed for ‘ggmap’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘maps’
It used to work, then I don't know what happened and it stopped working. Any ideas ? I tried removing the package then installing it again but it still doesn't work
Next time when installing packages, try this:
install.packages("ggmap",dependencies=TRUE)
library(ggmap)
The extra argument will make sure all the necessary dependencies are also installed.

Resources