stan-dev / stan-dev/rstan

Can't load data from calling environment

Open
#690 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

Please provide a short summary (no more than a sentence or two).

rstan can not load data directly from the calling environment.

Description:

Describe the issue as clearly as possible.

Using the option in stan() to load the data directly from the environment rather than passing a list in does not work. I received Exception: variable does not exist error. I was able to pass in the data directly as a list and that worked.

Reproducible Steps:

Please report steps to reproduce the issue. If it's not possible to reproduce, please include a description of how you discovered the issue.

If you have a reproducible example, please include it.

fit <- stan(model_code = code)

Current Output:

If applicable, any relevant output from RStan.

Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : 
  Exception: variable does not exist; processing stage=data initialization; variable name=J; base type=int  (in 'modelf019580b27bf_10cdc817017e119334b16bfc660115b2' at line 3)
Expected Output:

If applicable, the output you expected from RStan.

RStan Version:

The version of RStan you are running (e.g., from packageVersion("rstan"))

> packageVersion("rstan")
[1] ‘2.19.2’
R Version:

The version of R you are running (e.g., from R.version.string)

> R.version.string
[1] "R version 3.6.1 (2019-07-05)"
Operating System:

Your operating system (e.g., OS X 10.11.3)

OSX 10.14.6

At my company we can replicate all of this on windows 10 with the latest release versions of R, RStudio, Rtools, rstan, etc...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported stan(model_code = code) call and compare loading data from the calling environment with passing the same data as a list. Use the reported variable does not exist error for J as the failure condition; done means environment-supplied data loads successfully without the data-initialization exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.