Comparison length > 1 in `cv_data_slice`.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
The failing check is in cv_data_slice in R/zCV-methods.R at line 26, where class(dlo[[vname]]) == "numeric" returns a length-2 logical when a column is a matrix such as mm. Reproduce by running sim_train_test(N=N, k=k, LOOCV=TRUE) from the Overthinking box in Chapter 7. Done when that call completes without the length-greater-than-one condition error and the per-column type check handles matrix columns.
Written by the indexing model from the issue text.
Description
While working through the 2nd book edition, I went to run R code 7.17 in the Overthinking box n p 210 (Chapter 7). The book code runs as is, but I was interested in computing the LOOCV value to replicate Figure 7.10, so I ran r <- sim_train_test( N=N, k=k, LOOCV=TRUE). I got an error which I traced back to the following line of cv_data_slice:
if (class(dlo[[vname]]) == "numeric") link to source
The call class(dlo[["mm"]]) returns "matrix" "array", so the comparison to "numeric" returns FALSE FALSE, which has length > 1, causing the error. I'm not sure the best way to correct this multiple class type issue, but will work on a PR unless someone beats me to it.
- Dominant language
- R
- Stars
- 2.4k
- Forks
- 632
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from rmcelreath/rethinking
-
Typo: p.381Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100
rmcelreath/rethinking#482 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rmcelreath/rethinking#476 ·
-
Typo: p.302Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
rmcelreath/rethinking#475 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
rmcelreath/rethinking#474 ·
-
Comma splice: p.557Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
rmcelreath/rethinking#471 ·
All issues in rmcelreath/rethinking
Similar issues
-
1.7
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pharmaverse/admiral#3235 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SticsRPacks/CroPlotR#185 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day