Re: [R] file path

2012-05-14 Thread David Winsemius
On May 14, 2012, at 6:35 AM, Berend Hasselman wrote: On 14-05-2012, at 12:07, Wincent wrote: Emm, my bad. I meant str <- "abc\d". Any ideas? gsub("", "", str) #1: One cannot execute: str <- "abc\d" , at least on my machine, since that throws an error because "\d" is an "unrecogn

Re: [R] file path

2012-05-14 Thread Berend Hasselman
On 14-05-2012, at 12:07, Wincent wrote: > Emm, my bad. > I meant str <- "abc\d". > Any ideas? gsub("", "", str) Berend __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] file path

2012-05-14 Thread Wincent
Emm, my bad. I meant str <- "abc\d". Any ideas? On 14 May 2012 18:02, Baoqiang wrote: > This works on Mac: > > str <- "abc/d" > gsub("/", "", str) > > Return: > "abcd" > > > Sent from my iPhone > > On May 14, 2012, at 4:28 AM, Wincent wrote: > >> Thanks for the suggestion. The file name in my ca

Re: [R] file path

2012-05-14 Thread Baoqiang
This works on Mac: str <- "abc/d" gsub("/", "", str) Return: "abcd" Sent from my iPhone On May 14, 2012, at 4:28 AM, Wincent wrote: > Thanks for the suggestion. The file name in my case is Chinese, which > makes the regular expression less useful. > > Anyway, I would like to pose a followup

Re: [R] file path

2012-05-14 Thread Wincent
gt; location, >>> as in your example. >>> >>> steve >>> >>> -Original Message- >>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >>> Behalf Of Wincent >>> Sent: Wednesday, May 09, 2012 11:

Re: [R] file path

2012-05-14 Thread Wincent
Thanks for the suggestion. The file name in my case is Chinese, which makes the regular expression less useful. Anyway, I would like to pose a followup question. I have a character string of "ABC\D", and want to strip away the "\" and want a returned character of "ABCD". How can I do it with gsub(

Re: [R] file path

2012-05-10 Thread jim holtman
-boun...@r-project.org] On >> Behalf Of Wincent >> Sent: Wednesday, May 09, 2012 11:15 AM >> To: Tal Galili >> Cc: r help >> Subject: Re: [R] file path >> >> Hmm, I don't think it gives what I want. >> >> For example, I assign a file name to f,

Re: [R] file path

2012-05-10 Thread Wincent
e to a specific location, > as in your example. > > steve > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Wincent > Sent: Wednesday, May 09, 2012 11:15 AM > To: Tal Galili > Cc: r help > Subject: R

Re: [R] file path

2012-05-10 Thread Upton, Stephen (Steve) (CIV)
Of Wincent Sent: Wednesday, May 09, 2012 11:15 AM To: Tal Galili Cc: r help Subject: Re: [R] file path Hmm, I don't think it gives what I want. For example, I assign a file name to f, > f <- "a?b.txt" > file.path("e:",f) [1] "e:/a?b.txt" The resultant

Re: [R] file path

2012-05-09 Thread Uwe Ligges
On 09.05.2012 17:14, Wincent wrote: Hmm, I don't think it gives what I want. For example, I assign a file name to f, f<- "a?b.txt" file.path("e:",f) [1] "e:/a?b.txt" The resultant character is not accepted as a file name by Windows OS. Not on Linux if you write to a smb file system, and

Re: [R] file path

2012-05-09 Thread Wincent
Hmm, I don't think it gives what I want. For example, I assign a file name to f, > f <- "a?b.txt" > file.path("e:",f) [1] "e:/a?b.txt" The resultant character is not accepted as a file name by Windows OS. On 9 May 2012 20:32, Tal Galili wrote: > Hi Wincent, > Have a look at: > ?file.path > > >

Re: [R] file path

2012-05-09 Thread Duncan Murdoch
On 09/05/2012 4:03 AM, Wincent wrote: Dear all, is there any function to assert whether a file path is legitimate, and to convert any potential file path to a legitimate file path? I automate a batch of files and write them to plain text files with cat(). The file argument of cat() is generated

Re: [R] file path

2012-05-09 Thread Tal Galili
Hi Wincent, Have a look at: ?file.path Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) --

[R] file path

2012-05-09 Thread Wincent
Dear all, is there any function to assert whether a file path is legitimate, and to convert any potential file path to a legitimate file path? I automate a batch of files and write them to plain text files with cat(). The file argument of cat() is generated automatically which may contain characte