On Fri, Jan 9, 2009 at 10:23 AM, Rau, Roland <r...@demogr.mpg.de> wrote: > Hi, > >> [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique >> Dallazuanna >> >> Try this also: >> >> substr(basename(myfile), 1, nchar(basename(myfile)) - 4) >> > > This, of course, assumes that the extensions are always 3 characters.
The regex solutions posted did not make this assumption. > > P.S. Any suggestions how to become more proficient with regular > expressions? The O'Reilly book ("Mastering...")? Whenever I tried > anything more complicated than basic usage (things like ^ $ * . ) in R, > I was way faster to write a new function (like above) instead of finding > a regex solution. See the links in the Links box at: http://gsubfn.googlecode.com > > By the way: it might be still possible to *write* regular expressions, > but what about code re-use? Are there people who can easily *read* > complicated regular expressions? > > ---------- > This mail has been sent through the MPI for Demographic Research. Should you > receive a mail that is apparently from a MPI user without this text > displayed, then the address has most likely been faked. If you are uncertain > about the validity of this message, please check the mail header or ask your > system administrator for assistance. > > ______________________________________________ > 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. > ______________________________________________ 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.