Re: [R] why R doesn't recognize my file?

From: Duncan Murdoch <>
Date: Thu, 24 Apr 2008 18:49:30 -0400

tzsmile wrote:
> i want to read a txt file "weekly". this file is in d:/my documents
> i tried the following
> a<-read.table("d:/my documents/weekly", sep=" ", header=TRUE)
> but get the following error:
> Error in open.connection(file, "r") : unable to open connection
> In addition: Warning message:
> cannot open file 'd:/my documents/weekly', reason 'No such file or
> directory' in: open.connection(file, "r")
> why?
Perhaps it has a filename extension, which Microsoft in their infinite wisdom is suppressing?

The easiest way to open a file in windows is to use file.choose() in place of a specification of the filename. It will return a correct filename, which read.table can use, i.e.

read.table(file.choose(), header=TRUE)


f <- file.choose()
read.table(f, header=TRUE)

Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 24 Apr 2008 - 22:55:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Apr 2008 - 01:30:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive