Possible Duplicate: Extract file extension from file path
I am in a state where i need to check the extension of files in my working directory and take some decision. I check it by list.files()
and it gives me all the files in the working directory with extension.
I get a list like
"GSM18423_PA-D_132.cel" "GSM18424_PA-D_206.cel" "GSM18425_PA-D_216.cel"
Now further I want a condition, if a file has extension .cel
do something like below.
if(extension==".cel")
...... else
......
As i looked for tools
package, but not working in my R version of R version 3.1.3 RC (2015-03-06 r67947)
. I tried install.packages("tools")
which pops up a window and asks to restart my system before installing but finally does nothing even no restart also. Finally i get a message
Installing package into ‘/home/hussain/R/i686-pc-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘tools’ is not available (for R version 3.1.3 RC)