Gabor Grothendieck wrote: > On Fri, Jan 9, 2009 at 6:52 AM, Wacek Kusnierczyk > > >> or have sub do the job for you: >> >> filenames.ext = c("foo.bar", basename("foo/bar/hello.dolly")) >> (filenames.noext = sub("[.][^.]*$", "", filenames.ext, perl=TRUE)) >> > > We can omit perl = TRUE here. > >
or maybe not, depending on the actual task: names = replicate(10000, paste(sample(c(letters, "."), 100, replace=TRUE), collapse="")) system.time(replicate(10, sub("[.][^.]*$", "", names, perl=TRUE))) system.time(replicate(10, sub("[.][^.]*$", "", names))) vQ ______________________________________________ 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.