-
-
Notifications
You must be signed in to change notification settings - Fork 65
Fix error with off by one indexing #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There are some checks on the length of the MCMC failing. I'm not sure what the best way to resolve these are without just hacking them. The files included in I think this is worth looking at, because running cmdstan as in the manual, followed by rcmdstan gives this error. Perhaps adding an 'index_adjust' option to |
Thanks for reporting this. I just opened an issue (#292) about this and I'll respond more over there (so we can have the discussion in a separate issue in case this particular PR doesn't end up being the solution). |
@johnlees was there an issue if you dealt with it as a character? If some tests failed, those tests might need a revisit? |
Yes, sorry I was getting:
I think changing to |
@rok-cesnovar An error in the test coverage, but otherwise passes. Does this fix look like what you envisioned? |
No problem at all! Its free Github instances :) Thanks for working on this! |
I think so yes. Will take a look shortly. |
It looks like the test coverage failure is due to the tests for |
Argh, yes. https://github.com/stan-dev/cmdstanr/blob/master/tests/testthat/helper-envvars-and-paths.R#L18 needs to be updated. Want to push to this PR or master @jgabry? I wont be at a computer till tomorrow morning. Can do it then. |
Yeah, no problem, I can fix that now. |
Codecov Report
@@ Coverage Diff @@
## master #291 +/- ##
=======================================
Coverage 90.11% 90.11%
=======================================
Files 12 12
Lines 2419 2419
=======================================
Hits 2180 2180
Misses 239 239
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnlees Looks good, thanks! I'm approving but will wait to merge in case @rok-cesnovar notices anything I missed.
Thanks @johnlees! |
Submission Checklist
Summary
There appears to be an off-by-one indexing issue in R vs C++. The default index of 0 found in the metadata is invalid for R lists which are 1-indexed. This leads to the following error, which is difficult for the user to comprehend:
The right solution to me would seem to be to convert the index into R's 1-index form, where they are used in this manner.
Copyright and Licensing
Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
John Lees
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses: