YuLab-SMU / biomedical-knowledge-mining-book

:books: Biomedical knowledge mining using GOSemSim and clusterProfiler
https://yulab-smu.top/biomedical-knowledge-mining-book/
69 stars 27 forks source link

enrichplot barplot doc with mutate example is broken #18

Closed hermidalc closed 2 years ago

hermidalc commented 2 years ago

Get following error when trying to run https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html#bar-plot:

library(DOSE)
data(geneList)
de <- names(geneList)[abs(geneList) > 2]
edo <- enrichDGN(de)

library(enrichplot)
barplot(edo, showCategory=20)

dplyr::mutate(edo, qscore = -log(p.adjust, base=10)) |> barplot(x="qscore")
Error in UseMethod("mutate") : 
  no applicable method for 'mutate' applied to an object of class "enrichResult"
huerqiang commented 2 years ago

You should run library(clusterProfiler) before dplyr::mutate(edo, qscore = -log(p.adjust, base=10)) |> barplot(x="qscore").

hermidalc commented 2 years ago

Works