Note that there are some explanatory texts on larger screens.

plurals
  1. POR list.files(my_working_directory) shows no files but I know they are there. How to fix?
    primarykey
    data
    text
    <p>I'm trying to work with R using a directory in my external hard drive as working directory. I can set the working directory to where I want, but when I use <code>list.files</code> R can't see anything. I also can't use <code>read.delim</code> to load a file.</p> <p>For example:</p> <pre><code>&gt; rm(list = ls()) &gt; WD&lt;-"../../../Volumes/My_HD/my_working_directory" &gt; setwd(WD) &gt; getwd() [1] "/Volumes/My_HD/my_working_directory" </code></pre> <p>So far so good, but then:</p> <pre><code>&gt; list.files(WD) character(0) </code></pre> <p>Whilst I would expect a list of the files that I know are there and that I can see and open with Finder and with the Terminal. Actually the R script itself is inside that directory. </p> <p>If then I try to open a file I get something like this:</p> <pre><code>&gt; myfile &lt;- read.delim(paste(WD,"/file_name", sep = ""), header = T) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file '../../../Volumes/My_HD/my_working_directory/file_name': No such file or directory </code></pre> <p>I thought I was doing something wrong specifying the path to the directory, but I tried point and click from RStudio (Session>Set Working Directory and either >To Source File Location or >Choose Directory...) and got the same unhappy result. </p> <p>I'm using R version 2.15.1 on a MacBookPro (OS X 10.7.05). I'm running R from RStudio version 0.97.551, but the problem is not related to RStudio as it happens also when I try directly on R.</p> <p>Any help will be very much appreciated. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload