From murdoch at stats.uwo.ca  Sun Jan 29 18:18:08 2006
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sun, 29 Jan 2006 12:18:08 -0500
Subject: [Rd] [R] help with read.table() function
In-Reply-To: <x2d5ibf04m.fsf@turmalin.kubism.ku.dk>
References: <20060129152620.65089.qmail@web33210.mail.mud.yahoo.com>	<43DCE4A4.4090703@free.fr>
	<x2d5ibf04m.fsf@turmalin.kubism.ku.dk>
Message-ID: <43DCF8D0.8060105@stats.uwo.ca>

(Moved from R-help).

This comes up often enough that I'm starting to think most functions 
that take filename arguments should have file.choose() as the default 
value.  Then one could do

read.table()

and have a dialog box pop up in Windows, or some other prompt for a 
filename in other platforms.  Are there any obviously bad side effects 
from a change like this?

Duncan Murdoch

On 1/29/2006 11:51 AM, Peter Dalgaard wrote:
> Romain Francois <francoisromain at free.fr> writes:
> 
>> Le 29.01.2006 16:26, oliver wee a ?crit :
>>
>>> hello, I have just started using R for doing a project
>>> in time series...
>>>
>>> unfortunately, I am having trouble using the
>>> read.table function for use in reading my data set.
>>>
>>> This is what I'm getting:
>>> I inputted:
>>> data <-
>>> read.table("D:/Oliver/Professional/Studies/Time Series
>>> Analysis/spdc2693.data", header = TRUE)
>>>
>>> I got:
>>> Error in file(file, "r") : unable to open connection
>>> In addition: Warning message:
>>> cannot open file 'D:/Oliver/Professional/Studies/Time
>>> Series Analysis/spdc2693.data', reason 'No such file
>>> or directory'
>>>
>>> as I am just a novice programmer, I really would
>>> appreciate help from you guys. Is there a need to
>>> setpath in R, like in java or something like that...
>>>
>>> I am using the windows version btw. 
>>>
>>> I have also tried to put the file in the work
>>> directory of R, so that I only typed 
>>> data <- read.table("spdc2693.data", header = TRUE)
>>> Again, it won't work, with the same error message.
>>>
>>> I would appreciate any help. thanks again.
>>>  
>>>
>> Hi, try :
>>
>> read.table(file.choose(), header=TRUE)
>>
>> and go to your file.
>> Also, you can look a ?setwd, ?getwd
> 
> Right. Or just file.choose() and see what the OS thinks your file is
> really called. The most common causes for symptoms like that are
> 
> (A) The file is "spcd2693.data"
> (B) There's an extra extension which ever helpful Windows decided to
> hide, as in "spdc2693.data.txt".
> 
>



[Rd] [R] help with read.table() function
Duncan Murdoch