Troubleshooting

Most problems during setup and early use are one of a handful of things. Find the symptom that matches yours below and open it for the fix. This page grows over time; if your problem isn’t here, the Install jstats page has the install-specific ones close at hand, and you can always report a new problem by email at SurveyCentre@griffith.edu.au — including the full error message and your R and jstats versions makes it quicker to sort out.

Installing jstats

The simplest fix is to remove jstats and install it fresh:

remove.packages("jstats")
install.packages("jstats",
  repos = c("https://jma61.r-universe.dev", "https://cloud.r-project.org"))
library(jstats)

On many Windows computers the Documents folder is synced by OneDrive — and by default that is where R keeps its package library (the folder your installed packages live in). OneDrive can lock files while it syncs, and an install that runs into a lock fails part-way with messages like the ones above.

Fixes, from simplest to most durable:

  1. Pause OneDrive and retry. Click the OneDrive cloud icon near the clock, choose Pause syncing, run the install line again, then resume syncing.

  2. Give R a package library outside the synced folder. This one-time setup ends the problem for good. Create a plain folder directly on your drive, such as C:\Rlibs. Then create a plain text file named .Renviron in your Documents folder containing this single line:

    R_LIBS_USER=C:/Rlibs

    (Note the forward slash — that’s how R writes paths.) Restart R and run the install line again; packages now install to the new folder, out of OneDrive’s reach.

A related, rarer cause of the same errors: a Windows username containing accented or non-English characters can break the library path in the same way. The same fix applies — a package library at a simple location like C:/Rlibs.

On managed work or lab computers, two things can stop the install: your account may not be allowed to install software, or the network may block downloads from sites it doesn’t recognize. Neither is anything you did wrong — and the request to your IT support is a small one. jstats installs as a ready-made binary (no compilers or build tools are needed), fetched from the two addresses in the install line: the r-universe repository (jma61.r-universe.dev) and an ordinary CRAN mirror (cloud.r-project.org). Ask IT either to allow those two addresses or to run the install line for you; either way it’s a quick job for them.

Starting RStudio and loading jstats

This almost always means an install command was put in your .Rprofile. That file runs every time R starts, so an install line tries to reinstall on every startup and can loop. Your .Rprofile should only ever hold lightweight startup lines like library(jstats) — never an install command. To recover: close RStudio, open your Project folder in your computer’s file manager, open the .Rprofile file in a plain text editor (Notepad on Windows, TextEdit on Mac), delete the install line, keeping the library(jstats) line (and its reminder comment, if your .Rprofile has one), save, and reopen RStudio.

While jstats is still in development it installs from an r-universe repository, and each time it loads it briefly checks that repository for a newer version. The package itself works fully offline, but on a machine that is connected to a network yet has no route to the open internet – common on locked-down lab or server installations – that check has to time out before loading finishes, so library(jstats) can pause for a few seconds.

To skip the check and load immediately, set this option before loading the package:

options(jstats.check_updates = FALSE)
library(jstats)

Putting the options(...) line above the library(jstats) line in your .Rprofile makes it the default every session. On an ordinary internet connection you can leave it out – the check is fast there, and it’s how you learn an update is available.

This is specific to this pre-CRAN version. Once jstats reaches CRAN, installing and updating happen the normal CRAN way, with no startup check of this kind.

This shows up two ways: you run library(jstats) in the Console and get this error, or — if your .Rprofile loads jstats automatically — the same error greets you every time RStudio starts. Either way, the usual cause is that R itself was updated, and updating R starts a fresh, empty package library — so jstats (along with any other packages you had installed) is no longer there.

The rule in plain words: R’s version numbers have three parts, like 4.5.2. Only a change to the middle number (4.5 → 4.6) starts a fresh package library; a last-number update (4.5.1 → 4.5.2) changes nothing about your packages. And this is about R, not RStudio — RStudio updates are always safe and never touch your packages. R has no built-in update notifier, so updating R is a separate, deliberate act; if you did it recently, this reinstall is the one follow-up chore.

(Why jupdate() can’t rescue you here: jupdate() is itself a jstats command, and jstats isn’t installed in the new library yet.)

The fix is the same install line as the first time — run it once and you’re back:

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

Don’t confuse this error with the harmless warning that jstats was built under R version 4.x.x — that one just means the ready-made copy was built on a slightly different R patch, needs no action, and clears on its own. This callout is about the actual error where jstats can’t be found at all.

jstats probably isn’t loaded in this session. Run:

library(jstats)

If it still isn’t found, check spelling and capitalization — R is case-sensitive, so jfreq and jFreq are different names.

The shipped datasets become available once the package is loaded. Run library(jstats) first, then try again. (If you’re working with your own data instead, make sure you’ve loaded it — see jstats with your own data.)

Typing commands in the Console

If you press Enter and the Console answers with a + instead of the usual > prompt, R thinks your command isn’t finished — nearly always a closing quotation mark or a closing parenthesis is missing. Press the Escape key (Esc) to cancel and get a fresh > prompt, then retype or re-paste the whole command. (Typing more into the + line rarely ends well; Escape and a clean start is quicker.)

These errors are R’s way of saying the punctuation in a command doesn’t add up — most often a missing comma between two inputs, or a missing or extra parenthesis or quotation mark. Compare your line character by character against the example you copied it from; the difference is usually one small mark.

A reading tip that helps with R errors in general: in a long error message, the most useful part usually comes after the final colon — start reading there, then work backward only if you need to.