Search code examples
rrcppgtsummary

Error: in m_str_extents_(x, fontname, fontsize, bold, italic, fontfile) : function 'Rcpp_precious_remove' not provided by package 'Rcpp'


I'm using tbl_summary function with as_flex_table() under R version 4.0.5 (2021-03-31) and Rstudio Version 1.4.1106 in a R-Markdown project with successfull results. But when I try using the same .Rmd under R version 4.1.0 (2021-05-18) and Rstudio Version 1.4.1717 I get the following error. "Error: in m_str_extents_(x, fontname, fontsize, bold, italic, fontfile) : function 'Rcpp_precious_remove' not provided by package 'Rcpp'" . I get this error when I use the function as_flex_table() only. Someone knows if the are uncompatibility issues.

Please help me

table1 <- tbl_summary (data, by=trt)) %>%
  add_n() %>% 
  add_p() %>% 
  modify_header(label = "**Variable**") %>% 
  add_overall() %>%
  modify_caption("Patient Characteristics") %>% 
  as_flex_table()

Solution

  • The problematic function m_str_extents_() is from gdtools. So likely you have a recent version or gdtools compiled against an older version of Rccp. Try updating Rccp to version 1.0.7 with install.packages() and with a bit of hope it should work.

    install.packages("Rcpp")
    

    For reference same problem described on Rccp mailing list which can summarised with

    TL;DR: update your library.