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(...)
时间: 2024-02-14 09:06:00 浏览: 228
这段代码输出的是一个backtrace,它是调试错误时用来追踪程序执行路径的一种工具。backtrace会输出当前程序的调用栈(call stack),也就是程序执行到当前位置时所有被调用的函数的信息。
在这段backtrace中,可以看到程序最开始是调用了cowplot::plot_grid函数,然后调用了其内部的align_plots函数,接着调用了lapply函数,最后调用了ggplot2的相关函数进行图形的绘制和计算。在这个过程中,程序出现了错误或者警告,导致程序执行失败。如果需要进一步调试程序,可以根据backtrace的信息,逐个排查每个函数的运行情况,找到错误的原因。
相关问题
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]], ...)
根据你提供的 `Backtrace` 信息,可以看出问题出在 `cowplot::plot_grid()` 函数中,具体是在运行 `cowplot::align_plots()` 函数时出现了问题。在 `align_plots()` 函数中,使用 `lapply()` 函数对 `plotlist` 中的每个元素应用了一个函数,但是这个函数中可能出现了一些错误。你需要检查一下自己的代码中是否有对 `plotlist` 进行了修改或者处理,导致其中的元素出现了错误,或者尝试使用 `rlang::last_trace()` 命令来查看更详细的错误信息,以便更好地定位问题所在。
Backtrace: ▆ 1. ├─... %>% cbind(census_data_clean$income) 2. ├─base::cbind(., census_data_clean$income) 3. ├─stats::predict(., newdata = census_data_clean) 4. ├─caret::dummyVars(" ~ .", data = .) 5. ├─caret:::dummyVars.default(" ~ .", data = .) 6. │ └─base::is.data.frame(data) 7. ├─dplyr::select(...) 8. ├─dplyr:::select.data.frame(...) 9. │ └─tidyselect::eval_select(expr(c(...)), data = .data, error_call = error_call) 10. │ └─tidyselect:::eval_select_impl(...) 11. │ ├─tidyselect:::with_subscript_errors(...) 12. │ │ └─rlang::try_fetch(...) 13. │ │ └─base::withCallingHandlers(...) 14. │ └─tidyselect:::vars_select_eval(...) 15. │ └─tidyselect:::walk_data_tree(expr, data_mask, context_mask) 16. │ └─tidyselect:::eval_c(expr, data_mask, context_mask) 17. │ └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init) 18. │ └─tidyselect:::walk_data_tree(new, data_mask, context_mask) 19. │ └─tidyselect:::as_indices_sel_impl(...) 20. │ └─tidyselect:::as_indices_impl(...) 21. │ └─tidyselect:::chr_as_locations(x, vars, call = call, arg = arg) 22. │ └─vctrs::vec_as_location(...) 23. └─vctrs (local) `<fn>`() 24. └─vctrs:::stop_subscript_oob(...) 25. └─vctrs:::stop_subscript(...) 26. └─rlang::abort(...)这是他的报错
这个报错是由于在对数据集进行选择操作时,指定的某些列名不存在的缘故。可能的原因是在进行数据清洗时,某些列被删除或重命名了,但是在后续的操作中仍然使用了旧列名。建议检查代码中指定的列名是否正确,并确保与数据集中存在的列名相匹配。如果仍然无法解决问题,请提供更多相关的代码和数据,以便更好地帮助您定位问题。
阅读全文
相关推荐
















