Duncan, Thanks.  Combined with what Brian Ripley wrote it all works.   For 
future thread searchers this worked: oldstring <- readline()
C:\Users\Rinker\Desktop\Research& Law\Data\School Data 09-10
chartr("\\", "/",oldstring) Thank you both,Tyler
 #============================================> Date: Tue, 30 Aug 2011 09:35:58 
-0400
> From: murdoch.dun...@gmail.com
> To: tyler_rin...@hotmail.com
> CC: r-help@r-project.org
> Subject: Re: [R] url prep function (backslash issue)
> 
> Brian Ripley told you how to do the translation, but there's another 
> problem:
> 
> On 30/08/2011 8:14 AM, Tyler Rinker wrote:
> 
> [ much deleted ]
> > When I try
> > the function the backslash gets me again:
> >
> > >
> > readyPath("C:\Users\Rinker\Desktop\Research&  Law\Data\School Data
> > 09-10")
> 
> The problem is that you haven't entered a string containing backslashes, 
> you've tried to enter a string containing escapes.  The parser sees a 
> single backslash and attaches it to the next letter, so \U is taken to 
> be the start of a Unicode character, and you get the error
> > Error: '\U' used without hex digits in character string starting
> > "C:\U"
> >
> 
> The way around this is to avoid the parser, by something like this:
> 
> oldstring <- readline()
> 
> C:\Users\Rinker\Desktop\Research&  Law\Data\School Data 09-10
> 
> 
> and then applying chartr to oldstring.
> 
> Duncan Murdoch
> 
> 
> > This is
> > what I'd like the function to return:
> >
> > [1]
> > "C:/Users/Rinker/Desktop/Research&  Law/Data/School Data 09-10"
> >
> > I want a
> > function in which I enter a path and it returns the path with backslashes
> >
> > replaced
> > with forward slashes. Is there a way to make a function to do this?
> >
> > Windows 7
> > user
> >
> > R version
> > 2.14 beta
> >
> > Thank you,
> >
> > Tyler
> > Rinker
> >
> >
> >
> >                                     
> >     [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> 
                                          
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to