Error installing PARTY package in R - r

Newbie R user here.
I wanted to install the party package in RStudio (Ver 0.98.507), but whether I install it directly from the CRAN repository or whether I save the file first and then load it in R, I get the following error message:
> install.packages("party")
Installing package into ‘C:/Users/Linda/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/party_1.0-15.zip'
Content type 'application/zip' length 731049 bytes (713 Kb)
opened URL
downloaded 713 Kb
package ‘party’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Linda\AppData\Local\Temp\~~~~~~~\downloaded_packages
> library("party", lib.loc="C:/Users/Linda/Documents/R/win-library/3.1")
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
object 'vI' not found
Error: package or namespace load failed for ‘party’
I am unable to interpret the error message.
Every other package download and installation has worked so far though (caret, tree, rpart) so I am confused why this is not working.

Install "multcomp", then "party"
install.packages("multcomp")
library(multcomp)
install.packages("party")
library(party)

I was using ctree. and then I wanted to change the font size of the tree chart. I installed package "partykit". Then ctree doesn't work anymore. I was spending LONG time try to debug.. Later I found out there is also a ctree in the "partykit". In order to run ctree using "party" we would need to uninstall "partykit" so that there is no conflict..
(might not be exactly what the question is trying to solve. but hope this would be a reference to others :-))

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

R Library issues - cannot remove prior installation of package ‘rlang’

When I try to run a particular function: I get the following error:
> wrangled_devices <- wrangle_devices(params$filtered_devices)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.12 is already loaded, but >= 1.0.1 is required
So I figure I'll update the package as instructed. But that doesn't work:
install.packages("rlang")
Installing package into ‘C:/Users/thebi/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/rlang_1.0.2.zip'
Content type 'application/zip' length 1721024 bytes (1.6 MB)
downloaded 1.6 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
Warning in install.packages :
problem copying C:\Users\thebi\Documents\R\win-library\4.1\00LOCK\rlang\libs\x64\rlang.dll to C:\Users\thebi\Documents\R\win-library\4.1\rlang\libs\x64\rlang.dll: Permission denied
Warning in install.packages :
restored ‘rlang’
The downloaded binary packages are in
C:\Users\thebi\AppData\Local\Temp\RtmpO2wx0n\downloaded_packages
If I try to manually delete the rlang folder, it won't let me saying it's in use in another program, ever though I've closed R studio. I could force the point, but I' afraid of breaking something.
Can anyone help me figure what's going on here. I suspect once I sort this library, there will be 100 others that need the same treatment.
The reason for this behaviour was as follows. The main R project was open in RStudio. It was inside this environment that I was experiencing the problems.
However, since my R code is actually built into a docker image, as part of a larger CI/CD controlled project, I happened to have a couple of R and Rmd files open in vscode. My vscode has several R plugins installed (it actaully promopts you to do this when it recognises an R file).
And as it turns out, vscode prevents you from working with your packages in RStudio. The message about the folder or file being open in another program must stem from vscode opening them in the background.

Is it possible to use package semPlot with R 3.6.2?

I upgraded R to version 3.6.2 and have discovered that package semPlot will not work. It installs without any problems, but when I try to load it I get the message,
Error: package or namespace load failed for ‘semPlot’ in
loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]): there is no package called ‘ggm’
I then tried to install ggm but get the following warning and error:
Warning in install.packages : dependency ‘graph’ is not available
There is a binary version available but the source version is
later:
binary source needs_compilation ggm 2.3 2.5 FALSE installing the source package ‘ggm’ trying URL
'https://cran.rstudio.com/src/contrib/ggm_2.5.tar.gz' Content type
'application/x-gzip' length 109414 bytes (106 KB) downloaded 106 KB
ERROR: dependency ‘graph’ is not available for package ‘ggm’ removing
‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ggm’
Warning in install.packages : installation of package ‘ggm’ had
non-zero exit status"
I then tried to install graph, but it says:
package ‘graph’ is not available (for R version 3.6.2).
I wondered if anyone else had experienced this problem, and had any solutions so I can load semPlot with R 3.6.2?
Many thanks.
I also have R 3.6.2 and get all errors you get. But when I try to install the semPlot package from GitHub, it works fine, as follows:
install.packages('devtools')
library(devtools)
install_github('SachaEpskamp/semPlot', dependencies = T)
library(semPlot)
Please not that I tried the cran/semPlot repository but didn't work for me, whereas SachaEpskamp/semPlot does.
Hope you get it working.

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.

R install package caret [duplicate]

I am trying to load ggplot2. I am using Windows 7. R tells me that ggplot2 has loaded successfully but when I try to use the library function it says it cannot find ggplot2. Here is what it says.
install.packages("ggplot2")
Installing package into ‘C:/Users/Owner/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/ggplot2_1.0.0.zip'
Content type 'application/zip' length 2675581 bytes (2.6 Mb)
opened URL
downloaded 2.6 Mb
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Owner\AppData\Local\Temp\RtmpyesS1j\downloaded_packages
I then tried to use the library function and got this message:
library("ggplot2")
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘munsell’
Error: package or namespace load failed for ‘ggplot2’
> head(diamonds)
Error in head(diamonds) : object 'diamonds' not found
I hope someone has an idea about what I have done wrong.
You should have executed this:
install.packages("ggplot2", dependencies=TRUE)

Resources