Error in Install.Packages:Type =="Both" Cannot Be Used with 'Repos =Null'

Install local package from zip archive

This is a common question ... so common, in fact, I didn't immediately find a SO question that was actually answered in an answer vice a comment. The most recent I found was @DirkEddelbuettel's comment here: add type="binary" to your command.

install.packages(repos=NULL) in RStudio

You can bypass the extra things that RStudio does when installing packages by calling utils::install.packages directly. Alternatively, under the Tools menu, there is an "Install Packages..." dialog which allows in the first dropdown to select installing from "Package Archive File (.zip; .tar.gz)"

The fact that the RStudio version of install.packages does not respect repos=NULL should probably be filed as a bug with RStudio.

Getting errors when installing R packages manually

  1. Download the .zip file for the package from https://cran.r-project.org/
  2. Open RGui
  3. Packages -> Install package(s) from local file(s)
  4. Navigate to the desired .zip file and click OK
  5. Wait a short while whilst the package installs

Rstudio unable to install 'psimetrica-R' package from Github

A github source repository is not an R package repository like CRAN -- so you cannot use install.packages().

Instead, use remotes::install_gihub() as in

if (!requireNamespace("remotes", quietly=TRUE)) install.packages("remotes")
remotes::install_github("stmueller/psimetrica-R")

This will install remotes if needed, and use it to install the desired package.

Or, at least, that would work in principle if psimetrica-R was a regular R source package. Here it fails because of its layout:

> remotes::install_github("stmueller/psimetrica-R")
Error: Failed to install 'unknown package' from GitHub:
cannot open URL 'https://api.github.com/repos/stmueller/psimetrica-R/contents/DESCRIPTION?ref=HEAD'
>

So you could fork the repo and make it proper package first. At least open source lets you do that.



Related Topics



Leave a reply



Submit