Error in system(cmd, intern = !verbose) : 'C:/Program' not found Error in sink(type = "output") : invalid connection

Operating System: Windows 10
Interface Version: rstan 3.5
Compiler/Toolkit: Rstudio

I was trying to run an example from the package edstan, and had the error message.

library(‘edstan’)
X <- spelling[, 2:5]
W <- cbind(1, spelling[, 1])
spelling_list <- irt_data(response_matrix = X, W = W)
Error in irt_data(response_matrix = X, W = W) : unused argument (W = W)

spelling_list <- irt_data(response_matrix = X)
twopl_fit <- irt_stan(spelling_list, model = “2pl_latent_reg.stan”, iter = 200, chains = 4)
Using C:/Users/xxxx/Documents/R/win-library/3.5/edstan/extdata/2pl_latent_reg.stan.
Error in system(cmd, intern = !verbose) : ‘C:/Program’ not found
Error in sink(type = “output”) : invalid connection

I would appreciate help on debugging the error.

My guess is that you’ve installed RTools (or whatever compiler you’re using) under “C:\Program Files”. You need to install it in a folder without spaces.

RTools is likely fine, but StanHeaders and rstan need to get back in sync via

remove.packages(c("StanHeaders", "rstan"))
file.remove(".RData")
# restart R
install.packages(c("StanHeaders", "rstan"))
library(rstan)

THank you! Reinstalled R and Rtools in another folder and the program is running.