mauede at alice.it
2010-Jun-10 15:24 UTC
[R] selecting and excluding files through a pattern
I have the following files list:> list.files()[1] "Prostate-Cancer_cvs_Dir" [2] "Prostate_Cancer-miRNAs&Genes.Pathway.xml" [3] "Prostate_Cancer_Pathways-miRNAs-GeneTargets-Dir" [4] "Prostate_Cancer_Pathways-miRNAs-GeneTargets-Dir.zip" [5] "Prostate-miRNAs.OrganTargets.txt" [6] "Prostate_Organ-miRNAs-GenesTargets-Dir" [7] "Prostate_Organ-miRNAs-GenesTargets-Dir.zip" [8] "Prostate_Organ-miRNAs-Targets.xml" [9] "Prostatic_Neoplasm-miRNAs.DiseaseTargets.csv-KO" [10] "Prostatic_Neoplasm-miRNAs.DiseaseTargets.txt" [11] "Prostatic_Neoplasms-miRNAs-GeneTargets-Dir" [12] "Prostatic_Neoplasms-miRNAs-GeneTargets-Dir.zip" [13] "Prostatic_Neoplasms-miRNAs.xml" I'd like to find the pattern expression which selects only the directories excluding the one whose pathname contains "csv". I tried:> list.files(pattern="Prostate*Dir")But I do not know how to exclude the names containing the string "csv" at the same time. Thank you for any help, Maura ; tutti i telefonini TIM! [[alternative HTML version deleted]]
Jorge Ivan Velez
2010-Jun-10 15:30 UTC
[R] selecting and excluding files through a pattern
Hi Maura, Try list.files(pattern = 'csv') HTH, Jorge On Thu, Jun 10, 2010 at 11:24 AM, <> wrote:> I have the following files list: > > > list.files() > [1] "Prostate-Cancer_cvs_Dir" > [2] "Prostate_Cancer-miRNAs&Genes.Pathway.xml" > [3] "Prostate_Cancer_Pathways-miRNAs-GeneTargets-Dir" > [4] "Prostate_Cancer_Pathways-miRNAs-GeneTargets-Dir.zip" > [5] "Prostate-miRNAs.OrganTargets.txt" > [6] "Prostate_Organ-miRNAs-GenesTargets-Dir" > [7] "Prostate_Organ-miRNAs-GenesTargets-Dir.zip" > [8] "Prostate_Organ-miRNAs-Targets.xml" > [9] "Prostatic_Neoplasm-miRNAs.DiseaseTargets.csv-KO" > [10] "Prostatic_Neoplasm-miRNAs.DiseaseTargets.txt" > [11] "Prostatic_Neoplasms-miRNAs-GeneTargets-Dir" > [12] "Prostatic_Neoplasms-miRNAs-GeneTargets-Dir.zip" > [13] "Prostatic_Neoplasms-miRNAs.xml" > > I'd like to find the pattern expression which selects only the directories > excluding the one whose > pathname contains "csv". > I tried: > > list.files(pattern="Prostate*Dir") > But I do not know how to exclude the names containing the string "csv" at > the same time. > > Thank you for any help, > Maura > > > > > ; > > > tutti i telefonini TIM! > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]