[R] text file problem-Help needed

Duncan Murdoch murdoch.duncan at gmail.com
Tue Feb 8 14:54:58 CET 2011


On 08/02/2011 8:19 AM, George Pantop wrote:
> Hello!
> I have just uninstalled the R 2.4.1 that i was using and installed the latest version (R 2.12.1).
> In order to read a text file, i was copying the text file to C/Program Files/R/R 2.4.1, and the previous version was able to read it from there.
>
> I did the same think for the new version (copy text file to C/Program Files/R/R 2.12.1) and i tried to open it:
>
> data<- read.table('intersand.txt')
>
> but the result was:
>
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>    cannot open file 'intersand.txt': No such file or directory
>
> Can someone tell me what the problem is? Must i copy the text file somewhere else?


Use

setwd(choose.dir())

to set the current working directory wherever your file is, then you'll 
be able to read it.  Or use

read.table(file.choose())

to find the file and read it from wherever it was sitting.

Duncan Murdoch



More information about the R-help mailing list