stan-dev / stan-dev/cmdstanr

Avoid R’s 2 GB string limit in read_cmdstan_csv()

Open
#808 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
160
Forks
69
Avg merge
1d 19h
Merged PRs (30d)
15

Description

I am running a model with some out of sample predictions in generated quantities.

When I sample from the model without the out of sample predictions, everything is fine and runs as expected.

When I include the predictions, I get the following error:

Error in data.table::fread(cmd = fread_cmd, select = sampler_diagnostics, : R character strings are limited to 2^31-1 bytes

Am I correct that this suggests a very long string is being generated somewhere? Is it possible to work around?

Contributor guide

Open the contributing guide

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 at read_cmdstan_csv(), particularly the data.table::fread(cmd=...) call named in the error, and reproduce the failure with generated quantities containing out-of-sample predictions. Trace how the sampler diagnostics are read and determine what supported handling or workaround is needed for output exceeding R's string limit; done means the reported case no longer fails or has a documented workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.