[R] string problems with "\\" (Windows)

From: Charles Annis, P.E. <Charles.Annis_at_statisticalengineering.com>
Date: Mon 10 Jul 2006 - 02:54:41 EST

Greetings, R-ians:

I'm using R 2.3.1 on WindowsXP.

I need to find the name of a file at the end of a sting that contains the path + file, with the problematic "\\" as separators.

The string looks something like this:

"C:\\Documents and Settings\\myName\\My Documents\\R Projects\\Project1\\file.name.csv"

What I want is "file.name.csv"

Currently I use the name of the project as the splitter in

strsplit(string.name, split="Project1", extended = FALSE)

This works, of course, but I won't always be using folder Project1, so I need a more universal way to find the name of a file at the end of a string with "\\" separators.

Can I get there from here? (I've looked through previous R-help listing of similar problems but if it's there, I missed it.)


Charles Annis, P.E.

Charles.Annis@StatisticalEngineering.com phone: 561-352-9699
eFax:  614-455-3265

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 10 02:58:40 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 10 Jul 2006 - 04:16:02 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.