
124 R Programming for Bioinformatics
You can put this together with some of the commands above to create
sets of files or directories that can be used for other tasks. In the example
b elow, we obtain a list of files in the current directory and then remove the
directories from that list. The variable files contains the names of the files;
all directories have been excluded.
> x = list.files()
> x
[1] "AUTHORS" "COPYING" "COPYING.LIB"
[4] "COPYRIGHTS" "CRAN_mirrors.csv" "FAQ"
[7] "KEYWORDS" "KEYWORDS.db" "Makefile"
[10] "Makefile.in" "R.1" "R.aux"
[13] "RESOURCES" "Rscript.1" "THANKS"
[16] "html" "manual"
> files = x[!file.info(x)$isdir]
> files
[1] "AUTHORS" ...