Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt) : function ‘Rcpp_preci
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt) : function ‘Rcpp_preci相关的知识,希望对你有一定的参考价值。
Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt) : function 'Rcpp_precious_remove' not provided by package 'Rcpp'
目录
问题:
ggsurvplot(fit, pval = TRUE, conf.int = TRUE,
risk.table = TRUE, risk.table.y.text.col = TRUE)
解决:
install.packages("Rcpp")
library(Rcpp)
# Add risk table
# and change risk table y text colors by strata
ggsurvplot(fit, pval = TRUE, conf.int = TRUE,
risk.table = TRUE, risk.table.y.text.col = TRUE)
完整错误:
ERROR while rich displaying an object: Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt): 程序包'Rcpp_precious_remove'不提供'Rcpp'这样的函数
Traceback:
1. FUN(X[[i]], ...)
2. tryCatch(withCallingHandlers({
. if (!mime %in% names(repr::mime2repr))
. stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
. rpr <- repr::mime2repr[[mime]](obj)
. if (is.null(rpr))
. return(NULL)
. prepare_content(is.raw(rpr), rpr)
. }, error = error_handler), error = outer_handler)
3. tryCatchList(expr, classes, parentenv, handlers)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
5. doTryCatch(return(expr), name, parentenv, handler)
6. withCallingHandlers({
. if (!mime %in% names(repr::mime2repr))
. stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
. rpr <- repr::mime2repr[[mime]](obj)
. if (is.null(rpr))
. return(NULL)
. prepare_content(is.raw(rpr), rpr)
. }, error = error_handler)
7. repr::mime2repr[[mime]](obj)
8. repr_text.default(obj)
9. paste(capture.output(print(obj)), collapse = "\\n")
10. capture.output(print(obj))
11. withVisible(...elt(i))
12. print(obj)
13. print.ggsurvplot(obj)
14. .build_ggsurvplot(x = x, surv.plot.height = surv.plot.height,
. risk.table.height = risk.table.height, ncensor.plot.height = ncensor.plot.height)
15. ggplotGrob(plots[[i]])
16. ggplot_gtable(ggplot_build(x))
17. ggplot_gtable.ggplot_built(ggplot_build(x))
18. layout$render(geom_grobs, data, theme, plot$labels)
19. f(..., self = self)
20. self$facet$draw_panels(panels, self$layout, self$panel_scales_x,
. self$panel_scales_y, self$panel_params, self$coord, data,
. theme, self$facet_params)
21. f(...)
22. coord$render_axis_v(range, theme)
23. f(...)
24. panel_guides_grob(panel_params$guides, position = "left", theme = theme)
25. guide_gengrob(guide, theme)
26. guide_gengrob.axis(guide, theme)
27. draw_axis(break_positions = guide$key[[aesthetic]], break_labels = guide$key$.label,
. axis_position = guide$position, theme = theme, check.overlap = guide$check.overlap,
. angle = guide$angle, n.dodge = guide$n.dodge)
28. lapply(dodge_indices, function(indices) {
. draw_axis_labels(break_positions = break_positions[indices],
. break_labels = break_labels[indices], label_element = label_element,
. is_vertical = is_vertical, check.overlap = check.overlap)
. })
29. FUN(X[[i]], ...)
30. draw_axis_labels(break_positions = break_positions[indices],
. break_labels = break_labels[indices], label_element = label_element,
. is_vertical = is_vertical, check.overlap = check.overlap)
31. exec(element_grob, label_element, `:=`(!!position_dim, break_positions),
. `:=`(!!label_margin_name, TRUE), label = break_labels, check.overlap = check.overlap)
32. (function (element, ...)
. {
. UseMethod("element_grob")
. })(structure(list(family = "", face = "plain", size = 12, colour = c(`sex=2` = "#00BFC4",
. `sex=1` = "#F8766D"), fill = NULL, box.colour = NULL, linetype = NULL,
. linewidth = NULL, hjust = 1, vjust = 0.5, halign = NULL,
. valign = NULL, angle = 0, lineheight = 0.9, margin = structure(c(0,
. 2.4, 0, 0), unit = 8L, class = c("margin", "simpleUnit",
. "unit", "unit_v2")), padding = NULL, r = NULL, align_widths = NULL,
. align_heights = NULL, rotate_margins = NULL, debug = FALSE,
. inherit.blank = FALSE), class = c("element_markdown", "element_text",
. "element")), y = structure(c(0.272727272727273, 0.727272727272727
. ), unit = 4L, class = c("simpleUnit", "unit", "unit_v2")), margin_x = TRUE,
. label = c("sex=2", "sex=1"), check.overlap = FALSE)
33. element_grob.element_markdown(structure(list(family = "", face = "plain",
. size = 12, colour = c(`sex=2` = "#00BFC4", `sex=1` = "#F8766D"
. ), fill = NULL, box.colour = NULL, linetype = NULL, linewidth = NULL,
. hjust = 1, vjust = 0.5, halign = NULL, valign = NULL, angle = 0,
. lineheight = 0.9, margin = structure(c(0, 2.4, 0, 0), unit = 8L, class = c("margin",
. "simpleUnit", "unit", "unit_v2")), padding = NULL, r = NULL,
. align_widths = NULL, align_heights = NULL, rotate_margins = NULL,
. debug = FALSE, inherit.blank = FALSE), class = c("element_markdown",
. "element_text", "element")), y = structure(c(0.272727272727273,
. 0.727272727272727), unit = 4L, class = c("simpleUnit", "unit",
. "unit_v2")), margin_x = TRUE, label = c("sex=2", "sex=1"), check.overlap = FALSE)
34. richtext_grob(label, x = x, y = y, hjust = hj, vjust = vj, halign = halign,
. valign = valign, rot = angle, padding = padding, margin = mrg$margin,
. r = r, align_widths = align_widths, align_heights = align_heights,
. gp = gp, box_gp = box_gp, debug = element$debug)
35. mapply(make_inner_box, text, halign, valign, use_markdown, gp_list,
. SIMPLIFY = FALSE)
36. (function (text, halign, valign, use_markdown, gp)
. {
. if (use_markdown) {
. text <- markdown::markdownTohtml(text = text, options = c("use_xhtml",
. "fragment_only"))
. }
. doctree <- read_html(paste0("<!DOCTYPE html>", text))
. drawing_context <- setup_context(gp = gp, halign = halign,
. word_wrap = FALSE)
. boxlist <- process_tags(xml2::as_list(doctree)$html$body,
. drawing_context)
. vbox_inner <- bl_make_vbox(boxlist, vjust = 0, width_policy = "native")
. vbox_inner
. })(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]], dots[[4L]][[1L]],
. dots[[5L]][[1L]])
37. process_tags(xml2::as_list(doctree)$html$body, drawing_context)
38. dispatch_tag(node[[i]], tags[i], drawing_context)
39. process_tag_p(node, drawing_context)
40. unlist(list(process_tags(node, drawing_context), process_tag_br(NULL,
. drawing_context)), recursive = FALSE)
41. process_tags(node, drawing_context)
42. dispatch_tag(node[[i]], tags[i], drawing_context)
43. process_text(node, drawing_context)
44. lapply(tokens, function(token) {
. list(bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt),
. bl_make_regular_space_glue(drawing_context$gp))
. })
45. FUN(X[[i]], ...)
46. bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt)
参考:Risk tables in survminer not drawing ? RCPP error [duplicate]
参考:R
以上是关于Error in bl_make_text_box(token, drawing_context$gp, drawing_context$yoff_pt) : function ‘Rcpp_preci的主要内容,如果未能解决你的问题,请参考以下文章
# Error in colSums(iris) : ‘x‘ must be numeric,# Error in rowSums(iris) : ‘x‘ must be numeric
1064 - syntax error, error in :'Id`) USING BTREE
ERROR 1064 (42000): You have an error in your SQL syntax...
Error in eval(family$initialize) : y值必需满足0 <= y <= 1Error in eval(family$initialize) : y values mus