在运行ggtree脚本的时候出现报错:
Error in `stat_tree()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error in `is.waive()`:
! could not find function "is.waive"
Backtrace:
▆
1. ├─base::print(p)
2. ├─ggplot2 (local) `print.ggplot2::ggplot`(p)
3. │ ├─ggplot2::ggplot_gtable(data)
4. │ └─ggplot2 (local) `ggplot_gtable.ggplot2::ggplot_built`(data)
5. │ └─ggplot2:::by_layer(...)
6. │ ├─rlang::try_fetch(...)
7. │ │ ├─base::tryCatch(...)
8. │ │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
9. │ │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
10. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
11. │ │ └─base::withCallingHandlers(...)
12. │ └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
13. │ └─l$draw_geom(d, layout)
14. │ └─ggplot2 (local) draw_geom(..., self = self)
15. │ └─self$geom$draw_layer(...)
16. │ └─ggplot2 (local) draw_layer(..., self = self)
17. │ └─base::lapply(...)
18. │ └─ggplot2 (local) FUN(X[[i]], ...)
19. │ ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
20. │ └─self$draw_panel(...)
21. │ └─ggtree (local) draw_panel(...)
22. │ └─ggplot2:::empty(data)
23. └─base::.handleSimpleError(...)
24. └─rlang (local) h(simpleError(msg, call))
25. └─handlers[[1L]](cnd)
26. └─cli::cli_abort(...)
27. └─rlang::abort(...)
Execution halted
归根结底错误就是这个:! could not find function "is.waive"
remotes::install_version("ggplot2", version = "3.5.1")
remotes::install_github("YuLab-SMU/ggtree")
remotes::install_github("YuLab-SMU/ggtree", dependencies = TRUE, upgrade = "always")
if (!exists("is.waive")) {
is.waive <- \(x) inherits(x, "waiver") # nolint
}
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!