An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110215/9feaf9c6/attachment.pl>
Write File to Shared Drive
6 messages · Stuart Jaffe, Phil Spector, Peter Langfelder +2 more
Stuart -
In situations like this, I always recommend using file.choose,
so that you can navigate to the appropriate location. For example,
write.csv(mydata,file=file.choose())
will open a file browser so you can make sure the data will get
written to exactly where you want it.
You can also use a call to file.choose() by itself to see what
path R expects to see for a particular file or directory.
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spector at stat.berkeley.edu
On Tue, 15 Feb 2011, Stuart Jaffe wrote:
Hi, I'm trying to write a file to a shared drive on a network. I use the "write.csv" function with the correct path but R doesn't recognize the directory. Is there something different I have to do since it's a shared drive? Thanks. [[alternative HTML version deleted]]
______________________________________________ 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.
On Tue, 15 Feb 2011, Stuart Jaffe wrote:
Hi, ? I'm trying to write a file to a shared drive on a network. I use the "write.csv" function with the correct path but R doesn't recognize the directory. Is there something different I have to do since it's a shared drive? Thanks.
Check that you actually do have permissions to write to the directory you want to write to, and that the directory name is correct (remember that R always uses forward slashes in paths). Also, IIRC you need the permissions to see (read) all parent directories of the directory you want to write to. Peter
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110215/ce1115f4/attachment.pl>
On Tue, Feb 15, 2011 at 11:56 AM, Kevin Wright <kw.stat at gmail.com> wrote:
The original poster did not say what operating system was being used.? From my own experience on Windows, I always used "/" for reading from the local hard drive, but when I started working with Windows network shares/folders, I had to switch back to "\\" due to an unknown "feature" (bug?).
Interesting. I have never had to use \\ instead of / on a network drive, with the caveat that I haven't used WIndows since maybe R-2.6.x. Peter
FYI,
you can use the following to troubleshoot what is going on:
library("R.utils");
filename <- "MyFile.csv";
path <- ... # The directory where to store
pathname <- Arguments$getWritablePathname(filename, path=path);
or if you already have the full pathname:
pathname <- Arguments$getWritablePathname(pathname);
You will get an informative error if something is not correct, e.g. it
will check the path and report which part of the path is incorrect, it
will test and report on failed write permissions etc.
/Henrik
On Tue, Feb 15, 2011 at 12:04 PM, Peter Langfelder
<peter.langfelder at gmail.com> wrote:
On Tue, Feb 15, 2011 at 11:56 AM, Kevin Wright <kw.stat at gmail.com> wrote:
The original poster did not say what operating system was being used.? From my own experience on Windows, I always used "/" for reading from the local hard drive, but when I started working with Windows network shares/folders, I had to switch back to "\\" due to an unknown "feature" (bug?).
Interesting. I have never had to use \\ instead of / on a network drive, with the caveat that I haven't used WIndows since maybe R-2.6.x. Peter
______________________________________________ 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.