Stan Playground Issues with Pasting Scripts

Hello,

First, big thank you to all that have worked to make the Stan Playground a reality. It has been something I have been hoping for since I started using Stan!

I was playing around with a simple model for a teaching demonstration and I noticed that if I paste code into the analysis/data script. I get the following errors:

If I paste the following R code into the data script

data <- list(
  n_samp = 60034,
  n_cont = 3255,
  n_samp_conv = 592,
  n_cont_conv = 27
)

and run it I get the following error:

Error: <text>:1:14: unexpected invalid token
1: data <- list(
                 ^
Error: [stan-playground] data must be a list
hL: Can't convert object of type null to string.

But if I delete all the code, save, and click “generate example”, delete the generated code and paste the original, I get no error.

The same is true for the analysis script, except the error encountered there is:

Error: <text>:30:33: unexpected invalid token
29: rm(.SP_DATA_IN)
30: attr(draws, 'dimnames')$variable

Again, if I click “generate example” first in the analysis script before pasting my code I don’t have an issue.

I was able to repeatedly replicate this on an incognito browser window using Microsoft Edge. I’d be using Chrome, but company policy to use Edge.

Also, a great improvement to the interface would be the ability to collapse the sampling/data generation window. You can currently shrink the stan/data window with the vertical bar, but there is no horizontal bar to shrink the sampling/data generation to give the analysis tab more real estate. Becomes a bigger issue when working on a small laptop screen.

Thank you!!

1 Like

Hi @icostley - I think this is an issue with the fact that windows uses \r\n at the end of lines, where as other platforms use just \n. I guess WebR doesn’t like \r.
The fix is easy, and should be live after Normalize newlines before passing to scripts by WardBrian · Pull Request #249 · flatironinstitute/stan-playground · GitHub is merged.

We’re definitely still open to more suggestions on how to optimize screen real estate. There is a lot we’re trying to cram in, especially on smaller screens!

2 Likes

@icostley could you try the copy/pasting that was giving you difficulty again?

We’re also looking into allowing the analysis window to be expanded upward like the other components

1 Like

Amazing, works like a charm!

Noticed that the analysis window is now able to be expanded as well, Christmas has come early! Thank you!

1 Like