Dear R users, I am trying to figure out a way to extract the original file name of a .DAT (e.g., IC48.DAT) file imported into R using the file.choose() function, i.e.,
dat <- read.table(file.choose(), header = FALSE) The reason I would like to do this is to use that file name to name an output file, thus if I had the file name, e.g., file.name <- IC48 # then I do a bunch of stuff to dat Then I want to save it as: write.table(dat, file = paste(file.name"_output.DAT")) Does anyone know any way I could do this. Thanks in advance. Darcy. ______________________________________________ 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.