pharmaverse / pharmaverse/rtables
Error with `rbind` when using different dataset (it works when using same data.frame)
Open
Nobody has claimed this yet.
bug
sme
- Dominant language
- R
- Stars
- 260
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
library(rtables)
#> Loading required package: formatters
#> Loading required package: magrittr
#>
#> Attaching package: 'rtables'
#> The following object is masked from 'package:utils':
#>
#> str
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tbl <- basic_table() %>%
summarize_row_groups() %>%
build_table(starwars)
tbl2 <- basic_table() %>%
split_rows_by("vs") %>%
analyze("cyl") %>%
build_table(mtcars %>% mutate(vs = factor(vs)))
rbind(tbl, tbl2)
#> Error in chk_compat_cinfos(x[[1]], xi): Column structures not compatible: 2nd column structure has non-matching, non-null column counts
Created on 2024-02-22 with reprex v2.1.0
Similarly:
library(rtables)
#> Loading required package: formatters
#> Loading required package: magrittr
#>
#> Attaching package: 'rtables'
#> The following object is masked from 'package:utils':
#>
#> str
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tbl <- basic_table() %>%
build_table(mtcars)
tbl2 <- basic_table() %>%
split_rows_by("vs") %>%
analyze("cyl") %>%
build_table(mtcars %>% mutate(vs = factor(vs)))
rbind(tbl, tbl2)
#> Error in (function (cond) : error in evaluating the argument 'x' in selecting a method for function 'toString': all(mapdf$row_num == rinfo$abs_rownumber) is not TRUE
Created on 2024-02-22 with reprex v2.1.0
Contributor guide
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
Reproduce both reported rbind examples from the issue, first comparing tables built from the same data.frame and then from different datasets. Start at rbind and trace the column-structure and row-number checks that produce the errors. Done means the intended behavior for compatible tables is established and the reported examples have regression coverage or a clearly confirmed limitation.
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
- 45/100