[R] read.table

Martyn Plummer plummer at iarc.fr
Tue Dec 1 16:47:27 CET 1998

Zdenek Skala wrote:
> I am using R (rw0630 for Win32) and am simply unable to read-in the *.txt data.
> I've tried to copy the file (prum.txt) to different directories of rw0630 but get
> uniformly the answer "object "prum.txt" not found".

You need to put the name of the file in quotes, i.e.
R> read.table("prum.txt")

If the argument is not in quotes then read.table expects the argument to
be an R "object". In this case, the object would be a string containing
the name of the file, so

R> myfile <- "prum.txt"
R> read.table(myfile)

would work too.

> Which is the default
> directory for read.table() ??

It is the working directory of R (normally the bin directory in the R
home tree, but you can change this by creating a shortcut and changing
the "Start in" field in the properties dialogue).

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list