Rstudio Stan syntax checker is outdated

I am teaching a cognitive modeling course relying on Stan (2.29), where the students dominantly code in RStudio (1.4).

I noticed that a few new “recommended” best practices in coding Stan are marked as errors by the RStudio syntax checker:

  • array[n] int h; gives a “PARSER EXPECTED”
  • a few lpmf and lpdf using the | notation also are marked as errors

Everything compiles and works fine, but students tend to be confused by the deprecated warnings (if using the RStudio approved version) or error warnings (if using the Stan approved version).

Is there any info about upcoming updates? Or should I open a bug report for RStudio ?

from the twitter thread:

it’s a {RStan} thing not RStudio. rstan:::rstudio_stanc(“xx.stan”). Rstan is 2.21, yet the new array syntax is 2.26+

See here for how to make Rstudio use cmdstanr instead.

1 Like

Oh, and fyi that trick is automatically applied if you install aria and run either library(aria) or aria:: enable_rstudio_syntax_compile()

3 Likes

that’s super convenient, thanks!

Oh, I just remembered that aria does a lot of other stuff you might not want, so the .Rprofile trick is the simplest approach.

1 Like

fair enough. but aria is fun to explore :-)

Cool, glad to hear it. These posts, plus returning to a couple Stan projects, left me wanting to tweak it a bit again, so I’m currently redoing how one specifies custom makefile stuff, which should help make it easier to accommodate new compile features (like the new Oexperimental).