write_hrc2() fails when the first column contains a single value (e.g. a total column)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in R/writehrc.R at write_hrc2(), using the reproducible corr_table example from the issue. Inspect how d is used after a single-valued first column is removed, then verify the function succeeds with both sort_table = TRUE and sort_table = FALSE and produces the expected HRC output.
Written by the indexing model from the issue text.
Description
The issue occurs in the write_hrc2() function in R/writehrc.R.
Reproducible example
corr_table <- data.frame(
niveau1 = c("Total", "Total", "Total"),
niveau2 = c("A", "A", "B"),
niveau3 = c("A1", "A2", "B1")
)
write_hrc2(
corr_table = corr_table,
file_name = tempfile(fileext = ".hrc"),
sort_table = TRUE
)
Error
Error in Ops.data.frame(corr_table, corr_table_dec_left) :
‘==’ only defined for equally-sized data frames
The same error occurs with sort_table = FALSE.
Possible cause
d is computed before the first column is removed:
d <- dim.data.frame(corr_table)
if (length(unique(as.character(corr_table[,1]))) == 1) {
corr_table <- corr_table[,-1]
}
After removing the column, d is no longer consistent with corr_table.
A possible fix:
if (length(unique(as.character(corr_table[,1]))) == 1) {
corr_table <- corr_table[,-1]
d <- dim.data.frame(corr_table)
}
- Dominant language
- HTML
- Stars
- 11
- Forks
- 5
- Avg merge
- 1m
- Merged PRs (30d)
- 4
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.
More from InseeFrLab/rtauargus
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
InseeFrLab/rtauargus#58 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 64/100
InseeFrLab/rtauargus#57 ·
-
InseeFrLab/rtauargus#48 · 2 comments · 1 assignee ·
-
InseeFrLab/rtauargus#34 · 1 assignee ·
-
maj doc changements Open
Difficulty 1/5 Under an hour Newbie friendliness 48/100
InseeFrLab/rtauargus#30 ·
All issues in InseeFrLab/rtauargus
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
cisagov/cyhy-reports#149 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
open-compass/VLMEvalKit#1698 ·