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

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.

Related

Problems when installing the broom package

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 ...

Having issues installing an R package from Github

Please be patient with me as I'm a total noob, but I'm really trying to learn.
I'm trying to make a choropleth map for my country, and found an R package on Github that handles it excellently. However, I'm working on a university computer and I don't have write privileges on any drive but M://, so whenever the package tries to install on C:// it obviously throws an error. This hasn't been a problem since I can just specify a libpath as an argument on install.packages, but devtools::install_github does not seem to have such an argument.
I tried using
with_libpaths(new = "M:\R\win-library\3.2", install_github('diegovalle/mxmaps'))
But I got an error message saying
with_libpaths' is deprecated. Use 'withr::with_libpaths' instead.
I take this to mean that I need to install the "withr" package in order to use that? However, I keep getting errors when trying to install that package. First, I got
Warning in install.packages : installation of package ‘withr’ had
non-zero exit status
because of the not having access to C:// issue. I usually bypass this by installing directly from the binaries, but when I try that it tells me
"Warning in install.packages : package ‘withr’ is not available (for R
version 3.2.2)".
Other than updating my version of R (which will be a nighmare since I don't have installation privileges on this machine), how else can I either install withr or find another way to specify the directory to install the package from github?
I would suggest you to go with latest version of 3.4.All above mentioned packages are available under latest version.
Two ways to set local library paths (at least on Linux running R 3.5.3):
(1) At the beginning of your script, set the the .libPaths option to your local library path, i.e.: .libPaths("M:\R\win-library\3.2")
(2) Add to your .Renviron file a line that specifies your local library path: i.e.: R_LIBS="M:\R\win-library\3.2"
Note: For (1) You will need to manually run every time you start a new R session, whereas (2) will be set automatically when R starts.

problems with installing r packages on windows 10

I'm having problems installing r packages using R3.4.1 on windows 10.
E.g. I get the following message when trying to install a package:
package ‘ctv’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Program Files\R\R-3.4.1\library\file34470c9f23\ctv’ to ‘C:\Program Files\R\R-3.4.1\library\ctv’
I would really appreciate any assistance to resolve this issue.
Normally one puts the library in C:\user\yourname\Documents\R\win-library. Each version of R will have its library in a separate folder within that folder. In that case you won't get this error. If you reinstall R and accept the default for the library location then it will put the library there and you won't get this error.
If you prefer the configuration you have now because, for example, there are multiple users on your PC that need to share the library, then you will need to be Administrator each time you install a package; however, note that your current configuration is less secure than the default.

I am unable to use install.packages with the pkgs parameter to install a package from a local file (Win8.1, R3.10)

I am trying to install the rClr package. The instructions for this are to copy the package file onto the local computer and use install.packages(pkgs = "c:/.../rClr_0.5-2.zip"). I have a laptop, a server and a desktop. The laptop and the desktop are Windows 8.1, the server Windows 2012. All run R 3.1.0. The desktop installs rClr without a problem. The other two return the warning (error) message:
package ‘c:/.../rClr_0.5-2.zip’ is not available (for R version 3.1.0).
I've tried all obvious things. The error is pretty generic, it is given whenever install.packages can't find a file. The package is compatible with R 3.1.0, as evidenced by the fact it installs on my desktop. I've check for silly mistakes. I've tried moving the file to simpler directory structures (in case install.packages had a problem with spaces or special characters), I've given it maximum file permissions, tried playing around a few other things, but nothing makes a difference. I also tried replacing the local reference with a reference to the http link, and tried download another random package from CRAN to see if that would install, and both gave the same error message. I can't think of anything different in the environment of the laptop and the desktop. install.packages does work when installing the standard packages from CRAN.
Am I missing something obvious? Is there any known issue with install.packages (I thought maybe security but couldn't find anything on internet)? Are their ways to force an installation? Can anyone recommend something else to try?
Thanks.

How do you import an R module to a computer with no internet?

I'm working on a mac computer that has restricted-use data and cannot be connected to the internet. I need an R-module on the computer called rgexf. When I try to install it on R following the instructions here:
> install.packages('[where the zip file is]/rgexf_0.12.03.tar.gz', repos = NULL)
I get this error:
Installing package(s) into '/Users/samfinegold/Library/R/2.15/library' (as 'lib' is unspecified)
Warning: unable to access index for repository NULL/bin/macosx/leopard/contrib/2.15
Warning message: package '/Users/samfinegold/Desktop/rgexf_0.13.01.tar.gz' is not available (for R version 2.15.3)
I don't understand why the package wouldn't be available for the most recent version of R though.
You have specified a source package (identified by the "tar.gz" extension) but not told install.packages to use type ="source". You are also asking for the most recent version of the file which might be mated to version 3.0.0 for R.Its DESCRIPTION file says it does require compilation so you either need properly set-up tools for building source packages (if you want to install from source), or you need an appropriate binary version of the package. Whether there is an earlier version that can be mated to R 2.15.3 is an open question.
If you want to compile packages from source, you must have the correct XCode for the version of OSX that is on your machine. And you may need to get additional development tools from the ATT.research website. And if you have a more recent version of Xcode (higher than 3.x I think), don't forget to install the Command Line Tools package either from the Apple Developer Store or using the drop-down menu in a running installation of Xcode.
There is a MacOS binary at CRAN. Given your difficulties with source installation I would try to get a copy of that on a USB stick and retry with a binary distribution. (You do not need to use type="mac.binary" since that is the default for that parameter to install.packages.
Have you checked the permissions on the computer? The first warning message looks like it could be a root/admin vs. user issue for accessing the file. The other possibility since you have a NULL in the warning message is that you've entered the directory wrong (try without the '/' to lead perhaps).

Resources