Error: `correct_defaults(var)` must be a vector, a bare list, a data frame or a matrix.
DawnYe opened this issue · 2 comments
DawnYe commented
Greetings.
Errors occurred when creating DOC
:
# Write into doc object and pull titles/footnotes from excel file
doc <- rtf_doc(ht) %>% titles_and_footnotes_from_df(
from.file='./data/titles.xlsx',
reader=example_custom_reader,
table_number='14-1.01') %>%
set_font_size(10) %>%
set_ignore_cell_padding(TRUE) %>%
set_column_header_buffer(top=1)
Error details:
Error: `correct_defaults(var)` must be a vector, a bare list, a data frame or a matrix.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/tibble_error_need_rhs_vector>
`correct_defaults(var)` must be a vector, a bare list, a data frame or a matrix.
Backtrace:
1. `%>%`(...)
5. pharmaRTF::titles_and_footnotes_from_df(...)
6. pharmaRTF:::read_hf(...)
7. pharmaRTF:::fill_missing_data(.data, columns)
9. tibble:::`[<-.tbl_df`(`*tmp*`, is.na(.data[var]), var, value = NULL)
10. tibble:::tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value))
11. tibble:::vectbl_wrap_rhs_row(value, value_arg)
> rlang::last_trace()
<error/tibble_error_need_rhs_vector>
`correct_defaults(var)` must be a vector, a bare list, a data frame or a matrix.
Backtrace:
x
1. +-`%>%`(...)
2. +-pharmaRTF::set_column_header_buffer(., top = 1)
3. +-pharmaRTF::set_ignore_cell_padding(., TRUE)
4. +-pharmaRTF::set_font_size(., 10)
5. \-pharmaRTF::titles_and_footnotes_from_df(...)
6. \-pharmaRTF:::read_hf(...)
7. \-pharmaRTF:::fill_missing_data(.data, columns)
8. +-base::`[<-`(`*tmp*`, is.na(.data[var]), var, value = NULL)
9. \-tibble:::`[<-.tbl_df`(`*tmp*`, is.na(.data[var]), var, value = NULL)
10. \-tibble:::tbl_subassign(x, i, j, value, i_arg, j_arg, substitute(value))
11. \-tibble:::vectbl_wrap_rhs_row(value, value_arg)
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
system code page: 936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readxl_1.3.1 pharmaRTF_0.1.3 huxtable_5.4.0 assertthat_0.2.1 haven_2.4.1 forcats_0.5.1 stringr_1.4.0
[8] dplyr_1.0.7 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3 tibble_3.1.2 ggplot2_3.3.5 tidyverse_1.3.1
[15] glue_1.4.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 cellranger_1.1.0 pillar_1.6.1 compiler_4.0.3 dbplyr_2.1.1 tools_4.0.3 lubridate_1.7.10
[8] jsonlite_1.7.2 lifecycle_1.0.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.11 reprex_2.0.0 cli_3.0.0
[15] rstudioapi_0.13 DBI_1.1.1 xfun_0.24 xml2_1.3.2 withr_2.4.2 httr_1.4.2 knitr_1.33
[22] fs_1.5.0 generics_0.1.0 vctrs_0.3.8 hms_1.1.0 grid_4.0.3 tidyselect_1.1.1 R6_2.5.0
[29] fansi_0.5.0 modelr_0.1.8 magrittr_2.0.1 backports_1.2.1 scales_1.1.1 ellipsis_0.3.2 rvest_1.0.0
[36] colorspace_2.0-2 utf8_1.2.1 stringi_1.6.2 munsell_0.5.0 broom_0.7.8 crayon_1.4.1
elimillera commented
@DawnYe, Thanks for the issue.
I've tracked this down to an update in tibble 3.1.0 that has broken pharmaRTF. I'll be closing this issue here and raising it in that repository once I'm able to figure out the root cause and a solution.
elimillera commented
@DawnYe Issue has been found. While we're working on a fix in pharmaRTF you can still run the replication by doing the following:
remotes::install_version("tibble", "3.0.6")
and restarting your R session.