Skip to content

read.table

3 messages · Zdenek Skala, Martyn Plummer, Guido Masarotto

#
Sorry to all bothering you with a trivial question:
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". Which is the default 
directory for read.table() ??
Thanks!
Z. Skala
++++++++++++++++++++++
Zdenek Skala
e-mail:
Zdenek.Skala at incoma.cz

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Zdenek Skala wrote:
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.
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).

Martyn
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, Dec 01, 1998 at 03:01:16PM +0100, Zdenek Skala wrote:
read.table("c:\\Fryderyk\\Chopin\\prum.txt") #full path,
                                               #note the double slash
  or
  read.table("c:/Fryderyk/Chopin/prum.txt") #full path, Unix like name
  
  You can also give path relative to the current directory
  which is set by Windows using its convention, not by R,i.e.,
  1) if you launch R from a Windows command console
     c:\Amadeus\Mozart> ....rw06330\bin\R.exe <ret>
     you can use something like
     read.table("../../Fryderyk/Chopin/prum.txt")
     since "current directory"=c:\Amadeus\Mozart
  2) if you launch Rusing a short-cut "current directory"=../rw0630/bin
     or what you set in the property panel of the short-cut.
     
  g.     

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._