[R] file path

jim holtman jholtman at gmail.com
Thu May 10 14:53:06 CEST 2012


Has any mentioned

?make.names

On Thu, May 10, 2012 at 8:39 AM, Wincent <ronggui.huang at gmail.com> wrote:
> As I said, the file name is derived automatically from text processing.
> Thanks all the same.
>
> On 10 May 2012 20:35, Upton, Stephen (Steve) (CIV) <scupton at nps.edu> wrote:
>> Why not just construct a valid file name and use that in cat? You can then use
>> file.path to join paths together if you want to write to a specific location,
>> as in your example.
>>
>> steve
>>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at 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,
>>> 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 <tal.galili at gmail.com> wrote:
>>> Hi Wincent,
>>> Have a look at:
>>> ?file.path
>>>
>>>
>>>
>>> ----------------Contact
>>> Details:-------------------------------------------------------
>>> Contact me: Tal.Galili at gmail.com |  972-52-7275845 Read me:
>>> www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
>>> www.r-statistics.com (English)
>>> ----------------------------------------------------------------------
>>> ------------------------
>>>
>>>
>>>
>>>
>>> On Wed, May 9, 2012 at 11:03 AM, Wincent <ronggui.huang at gmail.com> 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 automatically which
>>>> may contain characters such as ? < >, unacceptable in Windows OS.
>>>> What I do at this moment is to strip such characters off with gsub().
>>>> Is there any direct way to make legitimate file path without detailed
>>>> knowledge about the naming rule specific to a OS?
>>>>
>>>> Best
>>>>
>>>> --
>>>> Wincent Ronggui HUANG
>>>> Sociology Department of Fudan University PhD of City University of
>>>> Hong Kong http://homepage.fudan.edu.cn/rghuang/cv/
>>>>
>>>> ______________________________________________
>>>> R-help at 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.
>>>
>>>
>>
>>
>>
>> --
>> Wincent Ronggui HUANG
>> Sociology Department of Fudan University PhD of City University of Hong Kong
>> http://homepage.fudan.edu.cn/rghuang/cv/
>>
>> ______________________________________________
>> R-help at 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.
>
>
>
> --
> Wincent Ronggui HUANG
> Sociology Department of Fudan University
> PhD of City University of Hong Kong
> http://homepage.fudan.edu.cn/rghuang/cv/
>
> ______________________________________________
> R-help at 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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list