Skip to content
Prev 86927 / 398513 Next

How to Import Data

On 2/21/2006 9:13 AM, Adaikalavan Ramasamy wrote:
The advice to look at the FAQ is good, but it's not true that you need 
the full path.  Like other programs, R maintains a current working 
directory, and paths can be specified relative to that.  I usually put a 
line like

setwd('c:/my/working/dir')

at the start of scripts, so that the current directory is changed from 
the beginning.  Then I can use simple filenames to read files.

The other advice I usually give is to specify "file.choose()" instead of 
an explicit filename; this will open a file selection dialog.  (In my 
opinion, this should be the default, but some people disagree quite 
strongly.)

Duncan Murdoch