Skip to content

read_cmdstan_csv fails with unhelpful error if tilde expansion is needed (linux) #1097

@katrinabrock

Description

@katrinabrock

Describe the bug
If read_cmdstan_csv is provided a path to a valid csv that requires tilde expansion e.g. ~/my-project/mycsv.csv, it fails with an error like:

grep: ~/my-project/mycsv.csv: No such file or directory
grep: ~/my-project/mycsv.csv: No such file or directory
Error in dimnames(x) <- `*vtmp*` : 
  length of 'dimnames' [3] not equal to array extent`

which does not indicate to the user that the tilde was the problem.

To Reproduce
Steps to reproduce the behavior.
Take a working csv. run read_cmdstan_csv with absolute or relative path - success, with path including tilde - fail

E.g.

  • cmdstanr::read_cmdstan_csv('/home/myusername/my-project/mycsv.csv') - works
  • cmdstanr::read_cmdstan_csv('./mycsv.csv') - works
  • cmdstanr::read_cmdstan_csv('~/my-project/mycsv.csv') - fails

Expected behavior
Tilde expansion correctly occurs.

Operating system
Your operating system (e.g. mac os x 10.15, windows 10, etc.)
Ubuntu 24.04.2 LTS

CmdStanR version number
Your CmdStanR version number (e.g. from packageVersion("cmdstanr")).
‘0.9.0.9000’ issue both on latest version in runiverse and in master.

Additional context

grep --version
grep (GNU grep) 3.11
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

I found where there issue is and will make a PR later today.
cc @sonyaofthejungle

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions