I'm new to R. Trying to install the package UsingR but running into problems:
library(UsingR,lib="C:\[whereitwent]")
Loading required package: HistData
Error: package ‘HistData’ could not be loaded
In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called ‘HistData’
Now when I did the install.packages("UsingR", lib="C:\[whereitwent]") bit, there was a weird part:
Warning: unable to move temporary installation ‘C:[where it went]\library\file7946ce71334\acepack’ to ‘C:\[whereitwent]\R-Portable\App\R-Portable\library\acepack’ package ‘HistData’ successfully unpacked and MD5 sums checked
I was having this same problem yesterday except instead of "there is no package called 'HistData' it was telling me there is no package called 'Formula'. I uninstalled and reinstalled R Portable this morning, tried again, and this is the result. My professor did this exact thing on her computer right in front of me yesterday and everything worked fine. I've tried this on two computers myself and it's the same issue both places. I've tried googling this but can't find anything substantive, and frankly I'm not really even sure how to google this exact issue. Can anyone help me identify the problem?
Note: "[whereitwent]" is my edit here so I'm not showing off my whole thing including my name. Everything else is copied and pasted exactly as is.
If you just want to be able to install packages, this will set library path:
.libPaths('C:/[path]')
you might need to escape the slashes, I'm sorry I don't use windows. You can add this to a file .Rprofile in your home folder and you won't have to do it again.
Alternatively (or in concert) you may want to look at the packrat package which will install packages with the project you're working on
This error is related to permissions issues, run R or RStudio as administrator (assuming you're on windows) and re-install the package.
If you are unable to run as administrator you usually will not be able to write to the C:\Program Files directory on a corporate computer. All you need to do is change the directory to which the package is installing to a folder to which you have read write permissions. For example, on my computer:
install.packages("gdata", lib = "C:/Users/mkemp6/Desktop/Rscrap", repos = "http://dirichlet.mat.puc.cl/")
To view permissions on a specific folder, right click the folder, select the "Security" tab and and highlight your username.
The same problem was solved by updating R to 3.1.3
I was experiencing similar issue on my Ubuntu machine. I solved it by running R as a "sudo" user and then install the packages from CRAN.
Related
I wanted to add the package "mediation". R Studio therefore asked for the latest Rtools update, which I installed successfully. When I know try to run the install.packages("mediation"), this happens:
package ‘checkmate’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\Carolin\Documents\R\win-library\3.6’ for modifying
Try removing ‘C:\Users\Carolin\Documents\R\win-library\3.6/00LOCK’
I already searched this problem intensively on the internet, but the following suggested solutions didnt work for me:
install.packages("mediation", INSTALL_opts = c('--no-lock'))
as well as
unlink("C:/Users/Carolin/Documents/R/win-library/3.6/00LOCK")
I would be happy if somebody could help me with it.
Try to delete the aforementioned ‘C:\Users\Carolin\Documents\R\win-library\3.6/00LOCK’ by directly accessing the folder and manually deleting the file (If it actually is a file, which I do not know). [Let's hope it is not an essential file for R to work]
I was trying to install the package RINDSEL but I am unable to install it and I keep getting the following error:
Error in install.packages : cannot open the connection
I downloaded the package from:
rindsel_1.0_2.zip | Integrated Breeding Platform
and loaded it from the directory. Other packages from the directory can be installed but just not this one.
Is the package corrupt or could there be any other error?
I would really be grateful for any help. Thanks in advance
Rename the zip file RinSel Software into Rindsel. That's the name specified in the discription file.
Then, you can install the package in R with the command
install.packages("C:/path/to/Rindsel.zip",repos=NULL,type="win.binary")
That works fine... at first (!!!).
Problem with the Rindsel package is. It is quite old. It was build with R 2.13.1. Therefore, if you want to load the library which would be the next step to use the package in R you will get the error:
Problems building package (Error: "package has been build before R-3.0.0")
My suggestion: Contact the authors of the package and ask them if they can either provide the source file that you can build the package by yourself or if they can bundle the Rindsel package with a newer R version.
(Or you could try to hunt down an old R version and see if you can get the thing running with an old R... However, I would not seriously suggest to do that. It would probably result in conflicting dependencies with the other required packages...)
EDIT 15-02-2018: OP asked if one can build an R package with sources that are presumeably the Rindsel source files.
Yes, basically, you could do that. You would have to make a your own description and namespace file and put the source file in the R folder than invoke the command in R to build it....
But it's not neccessary with the script files provided by the link the OP posted.
OP, just run the scripts in R! It's quite easy.
Download the zip-file and extract it on your machine.
Go to that directory. The R command would be
setwd('path/to/your/directory')
Than run the R script, e.g, the KNIndex.r. It's simple:
source('KNIndex.r')
Then the script will run and produce some output / prompts.
For future readers,
I was able to fix the error by running RStudio with administrative privileges to get the command to work.
If that does not fix it, you might wish to try
Installing "r tools" if that is not installed already. That can be downloaded from
https://cran.r-project.org/bin/windows/Rtools/
Download a relevant package that you are trying to install (e.g., tidyverse_1.3.0.zip) from https://cran.rstudio.com/
and install that from local path
It can also be installed directly from the web using install.packages("https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip")
I had the same problem. R was not able to extract and compile the package files to the default installation directory for some system-specific reasons (not R related).
I was able to fix this by specifying the installation directory of the package lib using:
install.packages("your package", lib = 'path/to your/required/installation/directory')
You can then load the package by specifying the lib.loc option while loading it:
library('your package', lib.loc='path/to your/required/installation/directory')
A better solution:
Create a new environment variable (if you are using windows) R_LIBS_USER with the following directory path/to your/required/installation/directory.
This will change the default installation directory of the packages and make it easier to load and install them without specifying the location everytime.
Technically I have 2 probs when I tried to install a package:
1. The package can be installed normally from github by devtools::install_github, however, when I download the zip file and try to manually install it from R or RStudio, I failed. The package seems can't be installed in this way. So could somebody explain that.
2. I tried to fix some bugs by modifying the .r source codes in R directory of the package unzipped folder. Then I think I need to re-compile/re-construct the package. Could some one give me a tutorial to do that.
IOS: Windows10, 64bit; R and Rtools are both the newest.
For prob1, here is the screen capture:
Thanks.
Close R and RStudio (if applicable) and uninstall the package manually by deleting its folder from your file system
For your 2nd problem after following #1 you can reinstall it by installing from source:
install.packages(path_to_file, repos = NULL, type="source")
Please confirm that these worked for you or let me know if not.
I am currently trying to install packages on R. On the startup, I get the normal R message with
"Error: object 'getw' not found"
When I use the install.packages function, I get the same error at the end of the installation, one for each package I tried to install.
However, when I start R with R --no-init-file I can install packages normally.
I have been fishing around with Rprofile and other initialization settings of R. I have also done clean installs of R, and the message still appears.
Does anyone have an idea about how to remove this error? Also, this machine is running Ubuntu 14.04 Trust Tahr.
This sounds like something is wrong with the .Rprofile file. There can be more than one such file. At the beginning of an R session, R first searches for such a file in the working directory, then in the home directory.
You may also want to check if the environment variable R_PROFILE_USER is set (In an R shell, this can be checked with Sys.getenv("R_PROFILE_USER")). If yes, look at the .Rprofile file in that directory to see if there is any suspicious entry.
If all fails, make a copy of the .Rprofile file in your home directory and (if applicable) in your working directory with a different name. Then delete the file and try the installation again. If this succeeds you can afterwards restore the old .Rprofile file(s) by using the copy/copies that you made before.
I had the same error. In my case, this was due to a previous partially failed uninstall of the package I was trying to install. Manually removing the partially uninstalled version of the package then allowed intall.packages to succeed.
Full details:
I had run devtools::install_github(...) which prompted about newer versions of some required packages being available. I opted to install these updated versions in response to the prompt. One of these packages (Rcpp) failed to be installed with an error about being unable to remove the older version of that package (presumably due to the file being in use/locked somehow).
When I tried to install a newer version of Rcpp from install.packages, I got the above error.
After investigating various things, I eventually ran .libPaths() which output the location my packages are installed. I went to this folder, found the Rcpp subfolder, which was mostly empty except one file (Rcpp.dll) - presumably the file that failed to be deleted before. I deleted this file manually and deleted the Rcpp folder.
I then retried install.packages(...) which now succeeded.
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.