How to convert data in gmt format to dataframe? I downloaded c5: gene ontology gene sets file from http://software.broadinstitute.org/gsea/downloads.jsp

I opened the "c5.all.v6.2.symbols.gmt" file in csv format and It looks like below:



I want to convert the .gmt file into a dataframe. And it should look like below:



can anyone say how I can do that. Thanq
Ok. Answering my own question.

I did this way. And I got the output I want.

install.packages("msigdbr")
library(msigdbr)

m_df = msigdbr(species = "Homo sapiens", category = "C5")
head(m_df)


Output:

gs_name gs_id gs_cat gs_subcat human_gene_symb~ species_name entrez_gene
  &lt;chr&gt;   &lt;chr&gt; &lt;chr&gt;  &lt;chr&gt;     &lt;chr&gt;            &lt;chr&gt;              &lt;int&gt;
1 GO_14_~ M184~ C5     MF        AANAT            Homo sapiens          15
2 GO_14_~ M184~ C5     MF        AKT1             Homo sapiens         207
3 GO_14_~ M184~ C5     MF        ARRB2            Homo sapiens         409
4 GO_14_~ M184~ C5     MF        BAD              Homo sapiens         572
5 GO_14_~ M184~ C5     MF        DAB2IP           Homo sapiens      153090
6 GO_14_~ M184~ C5     MF        DDIT4            Homo sapiens       54541
# ... with 2 more variables: gene_symbol &lt;chr&gt;, sources &lt;chr&gt;


found this solution from here https://cran.r-project.org/web/packages/msigdbr/vignettes/msigdbr-intro.html