In gage package, you need to use function kegg.gsets() to generate gene set data:
library(gage)
kg.pfa=kegg.gsets("pfa")
kegg.gs=kg.pfa$kg.sets[kg.pfa$sigmet.idx]
note the species is pfa. pfd is not one of the 6833 species currently supported by kegg.gsets(). It is likely a recent addition to KEGG. You need to add it to korg data manually using something like:
pfd.info=c("T01051", "57267", "pfd", "Plasmodium falciparum Dd2", "", "0", "PFDG_03934", NA, NA, NA)
data(korg)
korg=rbind(korg, pfd.info)
kg.pfd=kegg.gsets("pfd")
kegg.gs=kg.pfd$kg.sets[kg.pfd$sigmet.idx]
head(kegg.gs, 3)
note that the gene IDs look like: "PFDG_00033" "PFDG_00121" etc. make sure you are using the same type of gene ID in your expression data.
you may also try our new package SBGNview for many more pathways beyond KEGG:
GitHub
https://github.com/datapplab/SBGNview
BioC
https://bioconductor.org/packages/SBGNview/
HTHs.
I am afraid that I am a beginner in R
How to upload "Plasmodium falciparum Dd2" data?
Check out the KEGGREST vignette for information on how to use the package. Found here: https://bioconductor.org/packages/release/bioc/vignettes/KEGGREST/inst/doc/KEGGREST-vignette.html
I haven't used this package much so I encourage you to check out the package vignette and documentation but I think to get the pathways you could do something like
keggLink("pathway", "pfd")