Using R I want to generate a list of genes only (without the accompanying text) from a pathway.

For example. If the input pathway is [KEGG prostate cancer](https://www.genome.jp/dbget-bin/www_bget?hsa05215),
I want my output to be a .csv list of the genes in that pathway. I tried:


    library("KEGGREST")
    
    keggGet("hsa05215")[[1]]$GENE

but that gives me a list of the number and gene description along with the gene symbol and I want a list consisting of the gene symbol alone. 

How do I get this?

Thank you.

I ended up solving it myself. Hopefully this helps anyone who has a similar need.

    library("KEGGREST")
    
    #Get the list of numbers, gene symbols and gene description
    names <- keggGet("hsa05215")[[1]]$GENE
    #Delete the gene number by deleting every other line
    namesodd <-  names[seq(0,length(names),2)]
    #Create a substring deleting everything after the ; on each line (this deletes the gene description).
    namestrue <- gsub("\\;.*","",namesodd)
    #export the vector as a csv
    write.csv(namestrue, file = "hsa05215",quote = F, row.names = F)

