With your R script, I got the same thing as I got before.
I'm running the standard off-the-shelf RStan.
The only diff I could see in our sessionInfo() is
that you had a later Rcpp version than me. So I
went and installed the later Rcpp and restarted. Same
result as I got before.
At least that means it's not a general RStan problem,
not that it helps solve your issue.
One thought: I'm using the R GUI --- are you using RStudio
or the command-line version of R? If so, can you see if
it works in the R GUI in a new session? Maybe we can
isolate where it's having a problem before asking for
help from those who know R far better than me.
- Bob
Here's my full session:
================================================================
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[R.app GUI 1.62 (6558) x86_64-apple-darwin10.8.0]
[History restored from /Users/carp/.Rapp.history]
> library('RStan')
Error in library("RStan") : there is no package called ‘RStan’
> library('rstan')
Loading required package: Rcpp
Loading required package: inline
Attaching package: ‘inline’
The following object is masked from ‘package:Rcpp’:
registerPlugin
rstan (Version 2.1.0, packaged: 2013-12-27 18:21:10 UTC, GitRev: 548aa7bbbb89)
> mc <- '
+ data{
+ int N;
+ real dist[N];
+ }
+ parameters{
+ real mu;
+ }
+ model{
+ dist ~ normal( mu , 1 );
+ }
+ '
>
> data = list( dist=rnorm(100) , N=100 )
>
> mfit <- stan( model_code=mc , data=data , chains=1 , iter=2000 )
TRANSLATING MODEL 'mc' FROM Stan CODE TO C++ CODE NOW.
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model 'mc' with error message:
EXPECTATION FAILURE LOCATION: file=input; line=4, column=9
real dist[N];
^-- here
DIAGNOSTIC(S) FROM PARSER:
variable identifier (name) may not be reserved word
found identifier=dist
Parser expecting: <identifier>
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.1.0 inline_0.3.13 Rcpp_0.10.6
loaded via a namespace (and not attached):
[1] stats4_3.0.2
================================================================