Skip to contents

Managed computers, the kind most hospitals and universities issue, add security layers that R sometimes trips over. Every problem on this page has been hit by a real tester and has a known fix. Work down the page until yours appears.

Whatever went wrong, the fastest first step is the same:

It checks your R version, your package library, and whether your network can reach the package servers, then names what needs fixing and offers to fix it.

“package ‘gradethis’ is not available for this version of R”

The message is misleading. Your R version is fine. gradethis is simply not on CRAN, the main package server, so the ordinary install.packages("gradethis") cannot find it and R blames your version instead of saying so.

Most often this means the course was installed without its packages, which happens when the dependencies = TRUE part of the install command is left off. Let the course install what it needs:

That looks in the right place (Posit’s R-universe server) and, if your network blocks that server, falls back to installing from GitHub automatically. To do it by hand instead, type this into the Console:

install.packages("gradethis",
                 repos = c("https://rstudio.r-universe.dev", getOption("repos")))

“The tutorial is missing required packages and cannot be rendered”

A lesson was opened before all the packages it needs were installed, and usually the missing one is gradethis (see above). Run check_setup(install = TRUE), say yes to the prompts, then open the lesson again.

“Error: unexpected input” when pasting a command

If the error quotes a strange address such as protect.checkpoint.com or safelinks.protection.outlook.com, the command was copied out of an email. Many workplace email systems rewrite every web address in a message for scanning, including addresses inside code, which breaks the command. Copy commands from this website or from the Get started guide, or type them in by hand. Never copy R code out of an email.

“HTTP error 403” or “API rate limit exceeded”

Nothing on your computer is broken, and the cause is not anything you did. This appears when the course is installed from GitHub with remotes::install_github() rather than with the command in the Get started guide.

GitHub allows 60 anonymous requests an hour from any one network address, and a hospital or university sends everybody’s traffic out through a single shared address. Colleagues installing the course on the same morning spend that allowance between them, and whoever arrives after it runs out sees the 403. The message names the hour at which it resets, so waiting is a fix in itself.

The better answer is to install from the course’s own server, which has no such limit:

install.packages("r4clinstats",
                 repos = c("https://apsmunro.r-universe.dev",
                           CRAN = "https://cloud.r-project.org"),
                 dependencies = TRUE)

Should your network block that server too, download the course as an ordinary file. A plain download does not count against the GitHub limit:

install.packages("remotes")
remotes::install_url(
  "https://github.com/apsmunro/r4clinstats/archive/refs/heads/master.tar.gz",
  dependencies = FALSE)

The dependencies = FALSE is deliberate: it stops R going back to GitHub for the rest. Follow it with check_setup(install = TRUE), which fetches the course packages from CRAN and R-universe.

Nothing installs at all

Some networks only allow traffic through a proxy server, and R does not always pick that up. check_setup() reports this as failing to reach CRAN. Two things to try:

  1. In RStudio: Tools ▸ Global Options ▸ Packages, and confirm the primary repository is set to a CRAN mirror.
  2. Ask your IT team whether a proxy is required for internet access from applications. If it is, they can give you the address to put in the http_proxy and https_proxy environment variables.

If CRAN works and only gradethis fails, your network is likely blocking the R-universe server; the automatic GitHub fallback described above usually gets around it. Should every route fail, download the Windows gradethis bundle in your ordinary web browser from rstudio.r-universe.dev/gradethis (the .zip under Downloads), then install the file directly:

install.packages("C:/path/to/the/downloaded/gradethis.zip",
                 repos = NULL, type = "win.binary")

Installs fail partway, or packages vanish after a restart

On many managed machines your Documents folder lives inside OneDrive, and R puts its package library there by default. OneDrive can lock files while it syncs, which corrupts installs. check_setup() spots this; the fix is one command:

It creates a package library outside OneDrive and points R at it. Restart R afterwards (Session ▸ Restart R), then reinstall the course packages with check_setup(install = TRUE).

The console has no > prompt, or looks frozen

Nothing is broken: a lesson is still running. A lesson holds on to your R console for as long as it is open, and closing the browser tab does not give it back, because the lesson runs in R rather than in the browser.

Click into the Console and press Esc, or click the red stop button at the top right of the Console pane. The > prompt returns, and learn() lists the lessons again.

“No tutorials found for package ‘r4clinstats’”

Your R session is holding an older view of the package, typically right after installing or updating it. Restart R (Session ▸ Restart R), run library(r4clinstats), and try again.

“there is no package called ‘reformulas’”

A dependency occasionally missed when finalfit installs. Install it directly:

install.packages("reformulas")

Still stuck?

Open an issue at the project page. Paste the exact red text you saw, along with the output of check_setup(), and say whether you are on a work-managed computer. Those three things are usually enough to diagnose it in one reply.