netcontrol for R

Installing the archived CRAN package netcontrol

The R package netcontrol has been removed from the current version of CRAN and the package has been archived. This means that doing install.packages("netcontrol") will now likely fail. It is possible to install packages that have been archived, but it’s a bit of a pain, especially on Windows.

MATH4341 students: We only use the function dlyap. This is NOT required for the summative tests. If you already have netcontrol installed, it will continue to work until you upgrade or reinstall R. I will re-write the notes, practicals and exercises to remove all reference to the netcontrol package, probably over Xmas. In the meantime, it is possible to install the package, following the instructions below, but doing so is probably not urgent.

CRANhaven

For a few weeks, the package may survive on CRANhaven. So the first thing to try is:

install.packages("netcontrol", repos = c("https://cranhaven.r-universe.dev", "https://cloud.r-project.org"))

If that works, great. If not, see below.

Installing an archived source package

Installing archived packages depends on what OS you are running. Please follow the instructions for your particular OS.

The CRAN netcontrol page explains that the package has been archived, and the archive shows that the only version available in the archive is 0.1.

MacOS / Linux

You should be able to install the package directly from the archive with

install.packages("https://cran.r-project.org/src/contrib/Archive/netcontrol/netcontrol_0.1.tar.gz")

If you are missing dependencies, which is likely, then installation will fail. However, the error messages should tell you what dependencies are missing. You can than install.packages all of the required dependencies, and try again. This should work, and isn’t too complicated. You can check if it has worked by doing

library(netcontrol)

which should return without error.

Windows

To install on Windows you will need Rtools and devtools which are big installs. You will therefore need a bit of patience and quite a bit of disk space.

Step 1: Install Rtools

You should first install Rtools. This is not a standard CRAN package, so you can’t install it using install.packages. Note the version of R that you are running (not your RStudio version), and go to the Rtools page. Very carefully choose the version of Rtools that is compatible with the version of R you are running. If you don’t, Rtools won’t work. Once you have selected the correct version, download and run the Rtools installer by clicking on the relevant link. When Rtools has successfully installed, move on to the next step.

Step 2: Install devtools

Installing devtools should be as simple as

install.packages("devtools")

but it is a big install with lots of dependencies, so it will take a while. When it is finished, check that it has worked by doing

library(devtools)

and making sure it doesn’t give an error. When devtools is successfully installed, go on to the next step

Step 3: Install netcontrol

Once you have Rtools and devtools, you should be able to directly install a specific version of a package from the CRAN archives. Here, just do

devtools::install_version("netcontrol", version="0.1") 

You can check that this has worked by doing

library(netcontrol)

which should return without error.

Note: If you skip installing Rtools, RStudio will helpfully offer to download and run the Rtools installer. Unfortunately, it will often choose an installer that is incompatible with the version of R you are running, so it won’t work. So, don’t skip the Rtools installation step.