Introduction to R 149
Note that, if the entire path of the file is not specified, R will try to find it
in the current directory which initially is something like “c:\R” (in Windows,
the current directory can be changed from the File menu of the R window).
From the command line, the directory can be changed with setwd:
> old=getwd()
> setwd("c:/Users/Sorin")
> getwd()
[1] "c:/Users/Sorin"
> setwd(old)
As another observation, the read.table function has a header=T/F op-
tion that tells the function whether the file contains a header or not. If the
argument header=TRUE, the co ntent of the first line will be used as variable
names (column names). However, the function is smart enough to auto-detect
whether the file has a header. In particular, if the first row