Unable to install package "onewaytests"

Hi everyone, I'm a student and I have to use R-Studio for the first time for my marked assignment. But I'm having trouble downloading this package called "onewaytests", help is much appreciated.

package ‘moments’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\USER\AppData\Local\R\win-library\4.2’ for modifying
Try removing ‘C:\Users\USER\AppData\Local\R\win-library\4.2/00LOCK’

I am unable to find this file that they have specified.

Could anybody please help me?

Information from install.package() help document says that:


There are various options for locking: these differ between source and binary installs.

By default for a source install, the library directory is ‘locked’ by creating a directory 00LOCK within it. This has two purposes: it prevents any other process installing into that library concurrently, and is used to store any previous version of the package to restore on error. A finer-grained locking is provided by the option --pkglock which creates a separate lock for each package: this allows enough freedom for parallel installation. Per-package locking is the default when installing a single package, and for multiple packages when Ncpus > 1L . Finally locking (and restoration on error) can be suppressed by --no-lock.

For a macOS binary install, no locking is done by default. Setting argument lock to TRUE (it defaults to the value of getOption("install.lock", FALSE) ) will use per-directory locking as described for source installs. For Windows binary install, per-directory locking is used by default (lock defaults to the value of getOption("install.lock", TRUE) ). If the value is "pkglock" per-package locking will be used.

If package locking is used on Windows with libs_only = TRUE and the installation fails, the package will be restored to its previous state.

Note that it is possible for the package installation to fail so badly that the lock directory is not removed: this inhibits any further installs to the library directory (or for --pkglock , of the package) until the lock directory is removed manually.

According to that, you may first looking for any folder in ‘C:\Users\USER\AppData\Local\R\win-library\4.2’ which name stars with "00LOCK" and delete it. Then try install the package again.

Another solution is using parameter INSTALL_opts = '--no-lock' while installing the package, like

install.packages("onewaytests", INSTALL_opts = '--no-lock')

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.