[R] Create and read symbolic links in Windows

3 views
Skip to first unread message

Santosh

unread,
May 2, 2013, 2:50:59 PM5/2/13
to r-help
Dear Rxperts..
Got a couple of quick q's..
I am using R in windows environment (both 32-bit and 64-bit)
a) Is there a way to create symbolic links to some data files?
b) How do I read data from symbolic links?

Thanks so much..
Santosh

[[alternative HTML version deleted]]

______________________________________________
R-h...@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.

Prof Brian Ripley

unread,
May 2, 2013, 3:22:17 PM5/2/13
to r-h...@r-project.org
On 02/05/2013 19:50, Santosh wrote:
> Dear Rxperts..
> Got a couple of quick q's..
> I am using R in windows environment (both 32-bit and 64-bit)
> a) Is there a way to create symbolic links to some data files?

See ?file.symlink. ??'symbolic link' should have got you there.

Note that this is not very useful for files, but that is a Windows and
not an R restriction.

> b) How do I read data from symbolic links?

The same ways you read data from files.

>
> Thanks so much..
> Santosh


--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595

Santosh

unread,
May 3, 2013, 2:33:30 AM5/3/13
to Prof Brian Ripley, r-help
Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't get
"file.symlink" to work, but "file.link" did return the result to be "TRUE"
but at the target location, I did not see any link.

Not sure I am missing anything more.. Hope it's nothing to do with
administrator accounts and administrator rights... Is it something I should
check with my system administrator?

Thanks,
Santosh


On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley <rip...@stats.ox.ac.uk>wrote:

> On 02/05/2013 19:50, Santosh wrote:
>
>> Dear Rxperts..
>> Got a couple of quick q's..
>> I am using R in windows environment (both 32-bit and 64-bit)
>> a) Is there a way to create symbolic links to some data files?
>>
>
> See ?file.symlink. ??'symbolic link' should have got you there.
>
> Note that this is not very useful for files, but that is a Windows and not
> an R restriction.
>
>
> > b) How do I read data from symbolic links?
>
> The same ways you read data from files.
>
>
>> Thanks so much..
>> Santosh
>>
>
>
> --
> Brian D. Ripley, rip...@stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________**________________
> R-h...@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

Prof Brian Ripley

unread,
May 3, 2013, 2:42:18 AM5/3/13
to Santosh, r-help
On 03/05/2013 07:33, Santosh wrote:
> Thanks for the suggestions. In windows (Windows 7, 64-bit), I couldn't
> get "file.symlink" to work, but "file.link" did return the result to be
> "TRUE" but at the target location, I did not see any link.
>
> Not sure I am missing anything more.. Hope it's nothing to do with
> administrator accounts and administrator rights... Is it something I
> should check with my system administrator?

You may need to update your R: although the posting guide asked you to
do that before posting. There was a relevant bug fix in 2.15.3.

>
> Thanks,
> Santosh
>
>
> On Thu, May 2, 2013 at 12:22 PM, Prof Brian Ripley
> <rip...@stats.ox.ac.uk <mailto:rip...@stats.ox.ac.uk>> wrote:
>
> On 02/05/2013 19:50, Santosh wrote:
>
> Dear Rxperts..
> Got a couple of quick q's..
> I am using R in windows environment (both 32-bit and 64-bit)
> a) Is there a way to create symbolic links to some data files?
>
>
> See ?file.symlink. ??'symbolic link' should have got you there.
>
> Note that this is not very useful for files, but that is a Windows
> and not an R restriction.
>
>
> > b) How do I read data from symbolic links?
>
> The same ways you read data from files.
>
>
> Thanks so much..
> Santosh
>
>
>
> --
> Brian D. Ripley, rip...@stats.ox.ac.uk <mailto:rip...@stats.ox.ac.uk>
> Professor of Applied Statistics,
> http://www.stats.ox.ac.uk/~__ripley/
> <http://www.stats.ox.ac.uk/~ripley/>
> University of Oxford, Tel: +44 1865 272861
> <tel:%2B44%201865%20272861> (self)
> 1 South Parks Road, +44 1865 272866 <tel:%2B44%201865%20272866> (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
> <tel:%2B44%201865%20272595>
>
> ________________________________________________
> R-h...@r-project.org <mailto:R-h...@r-project.org> mailing list
> https://stat.ethz.ch/mailman/__listinfo/r-help
> <https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide
> http://www.R-project.org/__posting-guide.html
> <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>


--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595

Santosh

unread,
May 3, 2013, 2:23:39 PM5/3/13
to Prof Brian Ripley, r-help
Thanks for your suggestion... I upgraded to R.3.0.0 in 64-bit Windows 7
environment..

This time when I use file.link..
I get the following error message: 'Cannot create a file when that file
already exists"
And I don't see the link.

The other function, file.copy, correctly copies to the target location.

Still confuse with the error msges...

Thanks,
Santosh
>> http://www.stats.ox.ac.uk/~__**ripley/<http://www.stats.ox.ac.uk/~__ripley/>
>>
>> <http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
>> >
>> University of Oxford, Tel: +44 1865 272861
>> <tel:%2B44%201865%20272861> (self)
>> 1 South Parks Road, +44 1865 272866 <tel:%2B44%201865%20272866> (PA)
>>
>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>> <tel:%2B44%201865%20272595>
>>
>> ______________________________**__________________
>> R-h...@r-project.org <mailto:R-h...@r-project.org> mailing list
>> https://stat.ethz.ch/mailman/_**_listinfo/r-help<https://stat.ethz.ch/mailman/__listinfo/r-help>
>>
>> <https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> >
>> PLEASE do read the posting guide
>> http://www.R-project.org/__**posting-guide.html<http://www.R-project.org/__posting-guide.html>
>>
>> <http://www.R-project.org/**posting-guide.html<http://www.R-project.org/posting-guide.html>
>> >
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>
> --
> Brian D. Ripley, rip...@stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/>
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>

[[alternative HTML version deleted]]

Santosh

unread,
May 3, 2013, 2:30:09 PM5/3/13
to Prof Brian Ripley, r-help
Just got it right.... please ignore the previous posting...

It worked!
Prof Ripley made my day!! :) THANK YOU!

Santosh

unread,
May 23, 2013, 10:03:34 PM5/23/13
to Prof Brian Ripley, r-help
Dear R experts,

This time I am unable create symbolic links to files as I had done last
time. I could not replicate what I had successfully tried last time (rerun
the same code without any modifications) .

I get the following error message..
[1] FALSE
Warning message:
In file.link(".file1", file2, :
cannot link './File1' to './file2', reason 'The specified network name is
no longer available'

The "file.exists", however, results TRUE when I test for source and target
folders and the source file.. I tried with mapping of drives , relative
folder path,and nothing worked.

The R version (on 64-bit Windows 7):

> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 0.0
year 2013
month 04
day 03
svn rev 62481
language R
version.string R version 3.0.0 (2013-04-03)
nickname Masked Marvel

Any suggestions are highly welcome!

Thanks,
Santosh

Uwe Ligges

unread,
May 25, 2013, 1:58:43 PM5/25/13
to Santosh, r-help, Prof Brian Ripley


On 24.05.2013 04:03, Santosh wrote:
> Dear R experts,
>
> This time I am unable create symbolic links to files as I had done last
> time. I could not replicate what I had successfully tried last time (rerun
> the same code without any modifications) .
>
> I get the following error message..
> [1] FALSE
> Warning message:
> In file.link(".file1", file2, :
> cannot link './File1' to './file2', reason 'The specified network name is
> no longer available'

Same here, and it worked for me, what was you actual call and permissions?

Please carefully read ?file.link and its section "Symbolic links on
Windows:"

Best,
Uwe Ligges

Uwe Ligges

unread,
May 25, 2013, 1:59:40 PM5/25/13
to Santosh, r-help, Prof Brian Ripley


On 25.05.2013 19:58, Uwe Ligges wrote:
>
>
> On 24.05.2013 04:03, Santosh wrote:
>> Dear R experts,
>>
>> This time I am unable create symbolic links to files as I had done last
>> time. I could not replicate what I had successfully tried last time
>> (rerun
>> the same code without any modifications) .
>>
>> I get the following error message..
>> [1] FALSE
>> Warning message:
>> In file.link(".file1", file2, :
>> cannot link './File1' to './file2', reason 'The specified network
>> name is
>> no longer available'
>
> Same here,

Nonsense, I meant to write "Works here" or some such ...

Best,
Uwe Ligges

peter dalgaard

unread,
May 25, 2013, 3:18:05 PM5/25/13
to Uwe Ligges, r-help, Prof Brian Ripley

On May 25, 2013, at 19:59 , Uwe Ligges wrote:

>
>
> On 25.05.2013 19:58, Uwe Ligges wrote:
>>
>>
>> On 24.05.2013 04:03, Santosh wrote:
>>> Dear R experts,
>>>
>>> This time I am unable create symbolic links to files as I had done last
>>> time. I could not replicate what I had successfully tried last time
>>> (rerun
>>> the same code without any modifications) .
>>>
>>> I get the following error message..
>>> [1] FALSE
>>> Warning message:
>>> In file.link(".file1", file2, :
>>> cannot link './File1' to './file2', reason 'The specified network
>>> name is
>>> no longer available'
>>
>> Same here,
>
> Nonsense, I meant to write "Works here" or some such ...

Shouldn't you be warming up to the fussball game anyway? ;-)

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk Priv: PDa...@gmail.com

Uwe Ligges

unread,
May 25, 2013, 5:02:07 PM5/25/13
to peter dalgaard, r-help, Prof Brian Ripley


On 25.05.2013 21:18, peter dalgaard wrote:
>
> On May 25, 2013, at 19:59 , Uwe Ligges wrote:
>
>>
>>
>> On 25.05.2013 19:58, Uwe Ligges wrote:
>>>
>>>
>>> On 24.05.2013 04:03, Santosh wrote:
>>>> Dear R experts,
>>>>
>>>> This time I am unable create symbolic links to files as I had done last
>>>> time. I could not replicate what I had successfully tried last time
>>>> (rerun
>>>> the same code without any modifications) .
>>>>
>>>> I get the following error message..
>>>> [1] FALSE
>>>> Warning message:
>>>> In file.link(".file1", file2, :
>>>> cannot link './File1' to './file2', reason 'The specified network
>>>> name is
>>>> no longer available'
>>>
>>> Same here,
>>
>> Nonsense, I meant to write "Works here" or some such ...
>
> Shouldn't you be warming up to the fussball game anyway? ;-)

Right, hence the mistake: I was in a hurry. ;-)
Now that "we" lost, time to do some work to forget quickly about it.

Best,
Uwe
Reply all
Reply to author
Forward
0 new messages