Skip to content
Prev 269046 / 398502 Next

UNC Windows path beginning with backslashes

Thanks Henrik, but I have 2 reasons for not using that approach:

A) If I don't map the drive until after R starts the UNC path is already 
present in several places I know about and probably some I don't, leading to 
the problems I started with.

So reason 'B' doesn't really matter to me, but as author of R.utils you may 
be interested that...
B) On my system those calls don't seem to work. Details here...
--------------------------
Loading required package: R.oo
Loading required package: R.methodsS3
R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See ?R.methodsS3 for 
help.
R.oo v1.8.1 (2011-07-10) successfully loaded. See ?R.oo for help.
R.utils v1.7.8 (2011-07-24) successfully loaded. See ?R.utils for help.
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
 [1] datasets  grDevices splines   graphics  stats     utils     tcltk
 [8] tools     methods   base

other attached packages:
 [1] R.utils_1.7.8      R.oo_1.8.1         R.methodsS3_1.2.1  RODBC_1.3-3
 [5] tree_1.0-29        nlme_3.1-102       MASS_7.3-14 
xlsReadWrite_1.5.4
 [9] svSocket_0.9-51    TinnR_1.0.3        R2HTML_2.2         Hmisc_3.8-3
[13] survival_2.36-9

loaded via a namespace (and not attached):
[1] cluster_1.14.0  grid_2.13.1     lattice_0.19-31 svMisc_0.9-61
#  It seems to think I have no mapped drives....
named character(0)
# Although I clearly have (in fact I'm running R from Z:), so I can't
# find a 'spare' drive letter
New connections will not be remembered.

Status       Local     Remote                    Network
-------------------------------------------------------------------------------
OK           F:        \\server10\microbiology   Microsoft Windows Network
OK           L:        \\server23\Stats          Microsoft Windows Network
OK           M:        \\server10\jewell         Microsoft Windows Network
OK           Q:        \\server04\pccommon (not backed up)
                                                 Microsoft Windows Network
OK           R:        \\server23\Template       Microsoft Windows Network
             Z:        \\campden\shares\Workgroup\Stats
                                                 Microsoft Windows Network
                       \\TSCLIENT\C              Microsoft Terminal Services
                       \\TSCLIENT\D              Microsoft Terminal Services
                       \\TSCLIENT\E              Microsoft Terminal Services
                       \\TSCLIENT\F              Microsoft Terminal Services
                       \\TSCLIENT\G              Microsoft Terminal Services
                       \\TSCLIENT\H              Microsoft Terminal Services
                       \\TSCLIENT\I              Microsoft Terminal Services
                       \\TSCLIENT\L              Microsoft Terminal Services
                       \\TSCLIENT\M              Microsoft Terminal Services
                       \\TSCLIENT\Q              Microsoft Terminal Services
                       \\TSCLIENT\R              Microsoft Terminal Services
The command completed successfully.
#  The commands you cited throw errors...
Error in list(`System$mapDriveOnWindows("K", 
"\\\\campden\\shares\\Workgroup\\Stats")` = <environment>,  :

[2011-08-19 09:16:28] Exception: Argument 'drive' is not a valid drive (e.g. 
'Y:'): K
  at throw(Exception(...))
  at throw.default("Argument 'drive' is not a valid drive (e.g. 'Y:'): ", 
drive)
  at throw("Argument 'drive' is not a valid drive (e.g. 'Y:'): ", drive)
  at method(static, ...)
  at System$mapDriveOnWindows("K", "\\\\campden\\shares\\Workgroup\\Stats")
named character(0)
Error in list(`System$unmapDriveOnWindows("K")` = <environment>, 
`method(static, ...)` = <environment>,  :

[2011-08-19 09:29:09] Exception: Argument 'drive' is not a valid drive (e.g. 
'Y:'): K
  at throw(Exception(...))
  at throw.default("Argument 'drive' is not a valid drive (e.g. 'Y:'): ", 
drive)
  at throw("Argument 'drive' is not a valid drive (e.g. 'Y:'): ", drive)
  at method(static, ...)
  at System$unmapDriveOnWindows("K")

Thanks for your interest,

Keith Jewell
---------------------------------------------
"Henrik Bengtsson" <hb at biostat.ucsf.edu> wrote in message 
news:CAFDcVCQE3uUkmmqSjJ0fpEVfJgrAbrgBT1g8drCXGpnsJebEHw at mail.gmail.com...
I think you can also do this from within R (e.g. in your .Rprofile)
using the R.utils package;

library("R.utils")
System$mapDriveOnWindows("K", "\\\\campden\\shares\\Workgroup\\Stats")
driveLetters <- System$getMappedDrivesOnWindows()
System$unmapDriveOnWindows("K")

These methods utilize 'subst' of MS Windows.

/Henrik

On Thu, Aug 18, 2011 at 6:12 PM, Keith Jewell <k.jewell at campden.co.uk> 
wrote:
<snip>