Replacing commas with new lines in R
1
0
Entering edit mode
Voke AO ▴ 760
@voke-ao-4830
Last seen 10.3 years ago
Hi all, I have a file that looks like this (the genes column from different DAVID functional annotation chart categories). I would like to replace the commas with new lines if possible so that I can have a single gene per row. How can I possibly do this in R? Thanks. Regards, Avoks [1] DCD, PPARG, FTO, IGF2BP2, TSPAN8, CDKAL1, LGR5, KCNJ11, TCF7L2, THADA, NOTCH2, HHEX, ADAMTS9, CDKN2A, CDKN2B, VEGFA, SYN2, CDC123, JAZF1, ADAM30, CAMK1D [2] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, TCF7L2 [3] HHEX, CDKN2B, FTO, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, TCF7L2 [4] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, TCF7L2 [5] STRAP, U2AF2, SNRPD1, XAB2, YBX1, SART1, NONO, HNRNPA3, HNRNPK, SRRM2, CDC40, DHX15, SRRM1, QKI, LSM2, PRPF31, PTBP1, SF1, RNPS1, CDC5L, SF3A2, HNRNPU, RBMY1A1, EIF4A3, SFPQ, KHSRP, RBM38, SNRPE [6] MAEA, AURKAIP1, PML, SMAD3, IGF1, CDC16, GAS1, RCC1, PROX1, TGFB1, TRIAP1, CDKN2A, CDKN2B, HNF4A, CDC123, PEBP1, RBM38, FOXC1, TPR, RAD17, SMARCA4, APC, DLG1
Annotation Annotation • 824 views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States
On Mon, Jun 4, 2012 at 8:03 AM, Ovokeraye Achinike-Oduaran <ovokeraye at="" gmail.com=""> wrote: > Hi all, > > I have a file that looks like this (the genes column from different > DAVID functional annotation chart categories). I would like to replace > the commas with new lines if possible so that I can have a single gene > per row. How can I possibly do this in R? Have a look at strsplit(). Sean > Thanks. > > Regards, > > Avoks > > [1] DCD, PPARG, FTO, IGF2BP2, TSPAN8, CDKAL1, LGR5, KCNJ11, TCF7L2, > THADA, NOTCH2, HHEX, ADAMTS9, CDKN2A, CDKN2B, VEGFA, SYN2, CDC123, > JAZF1, ADAM30, CAMK1D > [2] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, > TCF7L2 > [3] HHEX, CDKN2B, FTO, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, TCF7L2 > [4] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, > TCF7L2 > [5] STRAP, U2AF2, SNRPD1, XAB2, YBX1, SART1, NONO, HNRNPA3, HNRNPK, > SRRM2, CDC40, DHX15, SRRM1, QKI, LSM2, PRPF31, PTBP1, SF1, RNPS1, > CDC5L, SF3A2, HNRNPU, RBMY1A1, EIF4A3, SFPQ, KHSRP, RBM38, SNRPE > [6] MAEA, AURKAIP1, PML, SMAD3, IGF1, CDC16, GAS1, RCC1, PROX1, TGFB1, > TRIAP1, CDKN2A, CDKN2B, HNF4A, CDC123, PEBP1, RBM38, FOXC1, TPR, > RAD17, SMARCA4, APC, DLG1 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
Hi Sean and Nicholas, Thanks. strsplit() worked great for my purposes. And Nicholas, I wanted it to remain in a structure that worked for R. Sorry I wasn't very clear on that. Thanks again. -Avoks On Mon, Jun 4, 2012 at 2:16 PM, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > On Mon, Jun 4, 2012 at 8:03 AM, Ovokeraye Achinike-Oduaran > <ovokeraye at="" gmail.com=""> wrote: >> Hi all, >> >> I have a file that looks like this (the genes column from different >> DAVID functional annotation chart categories). I would like to replace >> the commas with new lines if possible so that I can have a single gene >> per row. How can I possibly do this in R? > > Have a look at strsplit(). > > Sean > > >> Thanks. >> >> Regards, >> >> Avoks >> >> [1] DCD, PPARG, FTO, IGF2BP2, TSPAN8, CDKAL1, LGR5, KCNJ11, TCF7L2, >> THADA, NOTCH2, HHEX, ADAMTS9, CDKN2A, CDKN2B, VEGFA, SYN2, CDC123, >> JAZF1, ADAM30, CAMK1D >> [2] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, >> TCF7L2 >> [3] HHEX, CDKN2B, FTO, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, TCF7L2 >> [4] HHEX, CDKN2A, CDKN2B, PPARG, IGF2BP2, CDKAL1, SLC30A8, KCNJ11, >> TCF7L2 >> [5] STRAP, U2AF2, SNRPD1, XAB2, YBX1, SART1, NONO, HNRNPA3, HNRNPK, >> SRRM2, CDC40, DHX15, SRRM1, QKI, LSM2, PRPF31, PTBP1, SF1, RNPS1, >> CDC5L, SF3A2, HNRNPU, RBMY1A1, EIF4A3, SFPQ, KHSRP, RBM38, SNRPE >> [6] MAEA, AURKAIP1, PML, SMAD3, IGF1, CDC16, GAS1, RCC1, PROX1, TGFB1, >> TRIAP1, CDKN2A, CDKN2B, HNF4A, CDC123, PEBP1, RBM38, FOXC1, TPR, >> RAD17, SMARCA4, APC, DLG1 >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY

Login before adding your answer.

Traffic: 440 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6