0

It's been one day and all my tables have stopped loading. No matter what I do (restart R, update packages, shut down computer) I keep getting the same error message for all of my tables:

Error: Problem with mutate() input row_numbers. x subscript out of bounds ℹ Input row_numbers is unlist(.data$row_numbers) %>% unname() %>% list().

And I'm not even using the mutate function? My beautiful tables just no longer work. I didn't load any new packages, and something major has changed. How can I troubleshoot this?

Here is what my code looks like for the survey data:

base %>% 
  select(baseline_age, Age.Category, Gender.Category, Race.Category,baseline_ethnicity, baseline_insurance, baseline_education, smrc_baseline_1, smrc_baseline_2, health_lit_one) %>% 
  gtsummary::tbl_summary(
              statistic = list(all_continuous() ~ "{mean} ({sd})", 
                               all_categorical() ~ "{n} / {N} ({p}%)"), 
              digits = all_continuous() ~ 1, 
              missing_text = "Missing",
              label = list(baseline_age ~"Mean Age (SD)", 
                          Age.Category ~"Age Category",  
                          Race.Category ~ "Race",  
                          Gender.Category ~ "Gender Identity",
                          baseline_insurance ~ "Reported source of payment for contraceptive services",
                          baseline_education ~ "Education",
                          baseline_ethnicity ~ "Ethnicity",
                          smrc_baseline_1 ~ "Confidence that I can take my medication when there is a change in my usual day",
                          smrc_baseline_2 ~ "Confidence that I can find someone to take me to the doctor’s office if I need help ",
                          health_lit_one ~ "How often do you have problems learning about your health condition because of difficulty understanding written information?")) %>% 
  modify_header(label ~ "**Variable**") %>% 
  modify_caption("**Table 1. Sociodemographics and Personal characteristics**") %>%
  bold_labels() 

It has worked perfectly up until a few hours ago and I'm so lost.

halfer
  • 19,824
  • 17
  • 99
  • 186
Jade
  • 9
  • 2
  • 1
    It looks like you're fairly new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data,`data.frame(x=...,y=...)` like the output from `dput(head(dataObject))`). Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Jan 22 '22 at 06:11
  • 1
    I created fake data and it ran without an issue. It may be a data issue. It may also be where you're trying to view this. Are you using R or R Markdown? If you are using R Markdown, what type of output is the YAML set to? – Kat Jan 22 '22 at 06:54
  • Your code looks like it should run to me without error. The gtsummary package released a new version yesterday, and maybe the update has a bug? Please, do as @Kat suggested and post a small snippet of code+data that replicates the error, and we can investigate. – Daniel D. Sjoberg Jan 22 '22 at 12:28
  • Thank you all so much! I think Daniel was right - gtsummary mustve updated something. When I restarted R for the 3rd -4th time and **only** loaded the gtsummary and tidyverse packages, it worked. I wonder if another package I use doesn't gel with gtsummary well after the update? I appreciate all your help and will heed your advice to use reproducible code in my questions in the future as you suggested! – Jade Jan 22 '22 at 17:33
  • @Jade I am the maintainer for gtsummary. If there is a way to get a reproducible example here, I can ensure this isn't a big or fix the bug. The code you posted runs without issue on my machine, so there isn't much more I can do. – Daniel D. Sjoberg Jan 22 '22 at 21:11
  • @DanielD.Sjoberg thanks for following up. Happy to report that whatever the issue was seems to have gone away even now when I load all my packages. The issue hasn't repeated since with any of my other tables. – Jade Jan 23 '22 at 17:56
  • Thanks for letting me know! I was worried about a person potential new bug – Daniel D. Sjoberg Jan 23 '22 at 19:31

0 Answers0