Backtrace: ▆ 1. └─cowplot::plot_grid(plotlist = plotlist, ncol = 1) 2. └─cowplot::align_plots(...) 3. └─base::lapply(...) 4. └─cowplot (local) FUN(X[[i]], ...) 5. ├─cowplot::as_gtable(x) 6. └─cowplot:::as_gtable.default(x) 7. ├─cowplot::as_grob(plot) 8. └─cowplot:::as_grob.ggplot(plot) 9. └─ggplot2::ggplotGrob(plot) 10. ├─ggplot2::ggplot_gtable(ggplot_build(x)) 11. │ └─ggplot2:::attach_plot_env(data$plot$plot_env) 12. │ └─base::options(ggplot2_plot_env = env) 13. ├─ggplot2::ggplot_build(x) 14. └─ggplot2:::ggplot_build.ggplot(x) 15. └─ggplot2:::by_layer(...) 16. ├─rlang::try_fetch(...) 17. │ ├─base::tryCatch(...) 18. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 19. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 20. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler) 21. │ └─base::withCallingHandlers(...) 22. └─ggplot2 (local) f(l = layers[[i]], d = data[[i]]) 23. └─l$compute_aesthetics(d, plot) 24. └─ggplot2 (local) compute_aesthetics(..., self = self) 25. └─base::lapply(aesthetics, eval_tidy, data = data, env = env) 26. └─rlang (local) FUN(X[[i]], ...)
时间: 2024-02-15 19:28:13 浏览: 23
根据你提供的 `Backtrace` 信息,可以看出问题出在 `cowplot::plot_grid()` 函数中,具体是在运行 `cowplot::align_plots()` 函数时出现了问题。在 `align_plots()` 函数中,使用 `lapply()` 函数对 `plotlist` 中的每个元素应用了一个函数,但是这个函数中可能出现了一些错误。你需要检查一下自己的代码中是否有对 `plotlist` 进行了修改或者处理,导致其中的元素出现了错误,或者尝试使用 `rlang::last_trace()` 命令来查看更详细的错误信息,以便更好地定位问题所在。
相关问题
Backtrace: ▆ 1. ├─cowplot::plot_grid(plotlist = plotlist, ncol = 1) 2. │ └─cowplot::align_plots(...) 3. │ └─base::lapply(...) 4. │ └─cowplot (local) FUN(X[[i]], ...) 5. │ ├─cowplot::as_gtable(x) 6. │ └─cowplot:::as_gtable.default(x) 7. │ ├─cowplot::as_grob(plot) 8. │ └─cowplot:::as_grob.ggplot(plot) 9. │ └─ggplot2::ggplotGrob(plot) 10. │ ├─ggplot2::ggplot_gtable(ggplot_build(x)) 11. │ │ └─ggplot2:::attach_plot_env(data$plot$plot_env) 12. │ │ └─base::options(ggplot2_plot_env = env) 13. │ ├─ggplot2::ggplot_build(x) 14. │ └─ggplot2:::ggplot_build.ggplot(x) 15. │ └─ggplot2:::by_layer(...) 16. │ ├─rlang::try_fetch(...) 17. │ │ ├─base::tryCatch(...) 18. │ │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 19. │ │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 20. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler) 21. │ │ └─base::withCallingHandlers(...) 22. │ └─ggplot2 (local) f(l = layers[[i]], d = data[[i]]) 23. │ └─l$compute_aesthetics(d, plot) 24. │ └─ggplot2 (local) compute_aesthetics(..., self = self) 25. │ └─ggplot2:::scales_add_defaults(...) 26. │ └─base::lapply(aesthetics[new_aesthetics], eval_tidy, data = data) 27. │ └─rlang (local) FUN(X[[i]], ...) 28. └─base::.handleSimpleError(...) 29. └─rlang (local) h(simpleError(msg, call)) 30. └─handlers[[1L]](cnd) 31. └─cli::cli_abort(...) 32. └─rlang::abort(...)
这段代码输出的是一个backtrace,它是调试错误时用来追踪程序执行路径的一种工具。backtrace会输出当前程序的调用栈(call stack),也就是程序执行到当前位置时所有被调用的函数的信息。
在这段backtrace中,可以看到程序最开始是调用了cowplot::plot_grid函数,然后调用了其内部的align_plots函数,接着调用了lapply函数,最后调用了ggplot2的相关函数进行图形的绘制和计算。在这个过程中,程序出现了错误或者警告,导致程序执行失败。如果需要进一步调试程序,可以根据backtrace的信息,逐个排查每个函数的运行情况,找到错误的原因。
Backtrace: ▆ 1. ├─pred_lm %>% roc_auc(truth = 是否发生, .pred_pass) 2. ├─yardstick::roc_auc(., truth = 是否发生, .pred_pass) 3. └─yardstick:::roc_auc.data.frame(., truth = 是否发生, .pred_pass) Run rlang::last_trace(drop = FALSE) to see 20 hidden frames.
这个Backtrace显示在运行`roc_auc()`函数时,代码中使用了`pred_lm`作为输入,但是在`roc_auc()`函数中没有正确指定`.pred_pass`列。这可能是因为在`pred_lm`中并没有包含`.pred_pass`列,或者是因为在调用`roc_auc()`函数时,没有正确指定`.pred_pass`列。
您可以尝试检查一下`pred_lm`数据框中是否包含`.pred_pass`列,并且检查一下是否正确指定了`.pred_pass`列。另外,您也可以尝试在`roc_auc()`函数中使用正确的列名。