I know the post was answered long ago but I just encounter the same situation, here is my solution. Hope it helps :)
I have succesffuly used the package multienrichjam (https://rdrr.io/github/jmw86069/jamenrich/) to transform an object of class data.frame into an enrichResult class object.
For example, using a Gprofiler modified table:
> head(df, 2)
term_name term_id adjusted_p_value term_size query_size intersection_size effective_domain_size intersections Enrichment GeneRatio BgRatio
RHO GTPases activate PAKs REAC:R-HSA-5627123 6.71e-14 21 51 2 10622 MYH9,FLNA 89.26 2/51 21/10622
EPH-Ephrin signaling REAC:R-HSA-2682334 2.88e-12 90 51 3 10622 ACTR2,ARPC4,MYL6 27.77 3/51 90/10622
> enr <- enrichDF2enrichResult(enrichDF = df, keyColname = "term_id", geneColname = "intersections", pvalueColname = "adjusted_p_value", descriptionColname = "term_name", pvalueCutoff = 0.05)
The threshold won't filter the table, it is information added to the object. Finally, modify the column names (my case enr@results) to match the ones required by enrichplot. In my case:
"ID" "Description" "pvalue" "geneID" "GeneRatio" "BgRatio" "p.adjust" "Count"