Problems when installing the broom package - r

I can not install the broom package. When I try I get this Error Message, that I can't understand:
installing source package 'broom' ...
** package 'broom' successfully unpacked and MD5 sums checked
** using staged installation
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/AndrisLagerlvf/Documents/R/win-library/3.6/00LOCK-broom/00new/broom/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'broom'
removing 'C:/Users/AndrésLagerlöf/Documents/R/win-library/3.6/broom'
Warning in install.packages :
installation of package ‘broom’ had non-zero exit status
I am using a Widows computer with Windows Version 1909 (OS-version 18363.657), and RStudio Version 1.2.5033, and R version 3.6.2.
When I update some packages it works fine, but when I try to update other packages I get similar error messages as above.
Further notes: I used to have the broom package installed, and tried to update the package but when I got the error message I uninstalled the package and then tried to install the package again, but got the same error message, so now I don't have access to the package.
Any suggestions on how to fix would be great! Thanks!

Check out/notice the difference between
C:/Users/AndrisLagerlvf/Documents/R/win-library/3.6
and
'C:/Users/AndrésLagerlöf/Documents/R/win-library/3.6/broom
That is (international) Encoding showing its ugly face.
I would suggest the following as a solution and also a quite common good practice.
Create a (most probably local) directory somewhere you have "good" access to that DOES NOT contain any exotic characters (eg C:\R-PKGS\win-library\3.6) then set this as your standard library path
.libPaths(c("C:/R-PKGS/win-library/3.6", .libPaths())) #watch out for the direction of the slashes (normal ones - not backslashes, since this is R code)
Put the above line into a/your ~/.Rprofile file eg via running file.edit('~/.Rprofile') in the Console.
Let me know if that does not help? I am curious because you mentioned that sometimes it works - my guess is that your routine works for those packages that are installed in R_HOME/library and not for those installed under your User directory, which contains the exotic characters. Additionally you could minggle around with your locale settings until R is satisfied with them, but I have not tested such a solution (yet) ... since this would involve heavy adjustments, to my locale and typeset settings (sorry for that).
Or even better if you want R to branch according to your Version ie if you have multiple subfolders for multiple differing minor R versions (eg R-3.5 and R-3.6 side by side) ie this is how my libPath setting looks like
.libPaths( c( paste0( "D:/R_LIB/", substr(getRversion(),1,3) ), .libPaths() ) )
This has the advantage compared to the ENV VAR approach that you can manage multiple R.version library subfolders ...

Related

RStudio - Not able to install packages after reinstallation of R & constant working directory issues

I recently had to have a new laptop build at work and therefore reinstalled R and R Studio through a designated 'Company Portal' that did the software installation for me (this might be the problem). When now trying to install and load packages for use, I am running in to the below error for packages (in this case for tidyverse):
Warning message: In options(stringsAsFactors = TRUE) :
'options(stringsAsFactors = TRUE)' is deprecated and will be
disabled Error in setwd("C:/R/WorkingDir") : cannot change working
directory Execution halted Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
I also had this error when I first loaded R up that seems to be reappearing due any attempt to install packages:
Error in setwd("C:/R/WorkingDir") :
cannot change working directory
I've never had this issue before using RStudio across numerous machines and software versions, can anyone advise what is going on? My name (and thus C:\ user file path(s)) does have an apostrophe in it, if that matters - but it has never been an issue before. Is some key installation setting now misaligned and if yes, can anyone advise how to resolve?

Unable to install dplyr in R 3.3.1

I can't seem to install dplyr or perhaps I really can't install it?
Here's what I have
install.packages("dplyr")
package ‘dplyr’ successfully unpacked and MD5 sums checked
Warning in install.packages :
package ‘C:/Users/808797/AppData/Local/Temp/Rtmpkl7AKB/downloaded_packages’ is not available (for R version 3.3.1)
also tried
>install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/dplyr_0.5.0.zip",repos=null,type=source)
also tried
> library("downloader")
> download("https://cran.r-project.org/bin/windows/contrib/3.3/dplyr_0.5.0.zip","dplyr")
> install.packages("dplyr")
Warning in install.packages :
package ‘dplyr’ is not available (for R version 3.3.1)
always the same is not available (for R version 3.3.1)
am i out of luck?
It is likely your network, or network connection. This is a widely-used package, and I just fired up Virtual Box to demonstrate that, in general, this works as expected.
Things you could try are e.g. downloading something and then checking the md5sum via tools::md5sum().
Otherwise, look at the R-on-Windows FAQ and check e.g. question 2.19 which recommends proxy settings.
the solution is a two step procedure
1] install.packages("assertthat")
2] search google dplyr_0.4.1.tar.gz ..download it from CRAN archives or somewhere ..while in RStudio Tools>InstallPackage(install via archive) ..browse to the .tar.gz ...initiate installation
Probably you are trying to download some package behind a proxy, without a correct configuration. I think that the error message is quite confusing!
For future readers, to solve this problem with RStudio on Linux you should create a file touch ~/.Renviron in your home, edit this file adding you proxy config vim ~/.Renviron (set variables http_proxy= and https_proxy=, each in a different row), then start/restart Rstudio. This should work.
Reference

ggplot2 version 1.0.1 won't load into R 3.2.2 for Windows

I just started using R and downloaded ggplot2
install.packages("ggplot2")
I get the following warning:
Warning in install.packages:
unable to move temporary installation '\\CHI-FIlE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\file27ac2d3b613c\ggplot' to '\\CHI-FILE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\ggplot2'
This warning is followed up with this error:
Error: invalid version specification 'NA'
In addition: warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
As anyone come across this problem before? Did I do something wrong in the setup?
If you have multiple versions of R running, and you try to update or reinstall a package in one version of R while it is loaded in another, then the old version of the package doesn't get completely removed.
Try closing down all instances of R, manually deleting the folder containing the package, then opening a single version of R and reinstalling.
As Pascal commented, antivirus file scans can also interfere with the installation process. Sometimes downloading the package zip/tar.gz file then installing from disk can circumvent the issue.

Error when installing R package using Rstudio

I want to install http://cran.r-project.org/src/contrib/Archive/mecdf/ using RStudio but when I use
> install.packages('C:\\Users\\jandre\\Desktop\\mecdf_0.6.1.tar.gz', repos=NULL, type="source")
I get this error:
Installing package into ‘C:/Users/jandre/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"C:/Program Files/R/R-3.1.1/bin/x64/R" CMD INSTALL -l "C:\Users\jandre\Documents\R\win-library\3.1" "C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz’ had non-zero exit status
This occurs in every package I want to install using the tar.gz file. I'm on Win7 x64. RStudio Version 0.98.1028
Can't think of a way to fix this at the moment -- sorry -- but the R administration manual says explicitly:
Note that installing R into a directory whose path contains spaces is not supported, and at least some aspects (such as installing source packages) will not work.
I don't know why this doesn't bite people much more often, given that C:/Program Files/... seems like a relatively normal place to install things on Windows.
I would also expect that the double quotation marks around your R executable name ("C:/Program Files/R/R-3.1.1/bin/x64/R") in the system call should have protected you from this problem ... ?
I had the same error message with the installation of some packages(under Windows 10 OS with R and Rstudio).
It seems that the R software (not R Studio) is dealing with the library where package are installed.
I uninstalled R and Rstudio and installed it a path without space (ex: C:\Program\R).I tried to load the packages that previously failed and it seemed to fix the problem.

Unable to install and run a package in R (windows)

I am working on a 64 bit windows system. And I have a 64 bit, 2.15.1 version of R installed in it. I am trying to install a package called "MethLAB" from the package menu, by selecting its local zip file from the "Packages" menu. However I am running into an error show below.
> utils: : :menuInstallLocal ()
package 'MethLAB' successfully unpacked and MDS sums checked
> library(MethLAB)
> MethLAB()
Warning message:
In file (filename, "r", encoding =encoding) :
unable to resolve 'bioconductor.org'
So the above is what i get when i try to run it. Can anyone help me with its proper installation and running ?
I suspect it is because you are not connected to the internet. Is that so? If it is then you should contact the people that wrote the package; it seems the software is trying to contact BioConductor for some reason, perhaps to download additional packages/functionality etc. To that end, make sure you have installed all the pre-requisite packages needed to run `MethLAB.
Do note that this is a warning only, not an error. Whether this stops the package from working or not is a different matter. Again you should take this up with the developers if you have followed all the instructions on how to install and use the package.

Resources