read_stan_csv fails due to problems with regular expressions
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
read_csv_header, which is called internally by read_stan_csv, will fail if the model name contains the string "thin" anywhere. In an example on the forums reported by @sdaza the Stan program was called "rethinking.stan". The problem is that this use of grep
doesn't account for the possibility that "thin" shows up in other parts of the header besides the thin argument. Unfortunately it can show up in several other places if the model name contains "thin", e.g. in file, profile_file, and stancflags:
# output
# file = /tmp/RtmphsRohn/rethinking-202110280252-1-434739.csv
# diagnostic_file = (Default)
# refresh = 100 (Default)
# sig_figs = -1 (Default)
# profile_file = /tmp/RtmphsRohn/rethinking-profile-202110280252-1-54c303.csv
# num_threads = 10
# stanc_version = stanc3 v2.27.0
# stancflags = --name=rethinking_model
This eventually results in an error when read_stan_csv tries to use the value of thin.
Reproducible Steps:
Run the code provided in the discourse post by @sdaza:
https://discourse.mc-stan.org/t/problem-using-rstan-read-stan-csv/25017/5
Current Output:
Error
Expected Output:
No error
RStan Version:
2.21.2
R Version:
4.1.1
Operating System:
Mac big sur
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rstan/R/misc.R at the linked grep usage around lines 1527-1529, and trace how read_csv_header supplies the thin value to read_stan_csv. Reproduce the discourse example with a model name containing "thin"; done means read_stan_csv completes without treating occurrences in other header fields as the thin argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100