[R] Unable to load a file: no such file or directory

Ray Brownrigg Ray.Brownrigg at ecs.vuw.ac.nz
Mon May 26 07:16:01 CEST 2014


On 26/05/14 10:25, Antonio Carazo wrote:
> 
> Hi,
> I have the file DATOS1 in the directory E:/R 3.0.2/R-3.0.2/bin/x64.
> If I try to load it, R returns me this error:
>> getwd()
> [1] "E:/R 3.0.2/R-3.0.2/bin/x64"
>> DATOS1<-matrix(scan("E:/R 3.0.2/R-3.0.2/bin/x64/DATOS1"),ncol=8)
> Error en file(file, "r") : no se puede abrir la conexión
> Además: Mensajes de aviso perdidos
> In file(file, "r") :
>   no fue posible abrir el archivo 'E:/R 3.0.2/R-3.0.2/bin/x64/DATOS1': No such file or directory
> 
> The file DATOS1 is a Text Document with this composition:
> 32   17   67   112   28   10   17   71
> 32    9   64   142   32   14    0   66
> 22   25   66   122   23   12   25   68
> 18   25   60   101   21   14   12   66
> 21    0   67   125   20   15    2   67
> 41    7   65   126   37   14   25   68
> 21    8   64   123   24   12    0   71
> 20    7   63   109   20   10   34   69
> 22    6   62   123   27   12    7   73
> 20   35   67   125   23   12   50   72
> 23   25   69   167   21   12   23   71
> 29   12   65   115   33   13    0   69
> 31    0   65   125   31   16    0   72
> 22    7   62   113   23   14   25   78
> 

If it's a text document created with a Windows application, then it is
very likely that the file name is really DATOS1.txt.  Another useful
thing to do in Windows is to use file.choose() whenever you want to open
a file:
DATOS1 <- matrix(scan(file.choose()), ncol = 8)

> The unit E: is an external hard disk.
> It seems like the path were wrong.
> I´ve read the FAQ´s, the Windows FAQ´s, the R document about scan() function and the related sections of An Introduction to R and the Import/Export manual, but I can´t find any answer of this error.
> Can anybody help me, please?
> Thank you
> 
Hope this helps,
Ray Brownrigg



More information about the R-help mailing list