Hello to everyone,
I am new to programming in R and am having trouble with the following
two commands
1.I am running a simple 1 line script "read.table(file="C:\\Document
and Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get
is "Error in file (file, "r"): cannot
open the connection In addition warning message In file (file, "r"):
cannot open file'C:\Document and
Settings\All Users\Desktop\colon cancer..txt
2.I am running the simple 1 line script print (file="C:\\Document and
Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get is
"error in print.default (file="C:\\
Document and Settings\\All Users\\Desktop\\colon cancer.txt"): argument x
is missing,with no default
I am not sure what I am supposed to enter as argument x.
Any help would be greatly appreciated
paul
[[alternative HTML version deleted]]
Try this: path <- file.choose() 1) read.table(path) 2) file.show(path) On Mon, Jun 2, 2008 at 3:33 PM, Paul Adams <pma3622@yahoo.com> wrote:> Hello to everyone, > I am new to programming in R and am having trouble with the following > two commands > 1.I am running a simple 1 line script "read.table(file="C:\\Document and > Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get > is "Error in file (file, "r"): cannot > open the connection In addition warning message In file (file, "r"): cannot > open file'C:\Document and > Settings\All Users\Desktop\colon cancer..txt > > 2.I am running the simple 1 line script print (file="C:\\Document and > Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get > is "error in print.default (file="C:\\ > Document and Settings\\All Users\\Desktop\\colon cancer.txt"): argument x > is missing,with no default > I am not sure what I am supposed to enter as argument x. > > Any help would be greatly appreciated > paul > > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
?read.table
And don't forget the " at the end of your filename
HTH
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Paul Adams
Sent: Monday, June 02, 2008 2:34 PM
To: r-help at r-project.org
Subject: [R] print and read.table commands
Hello to everyone,
I am new to programming in R and am having trouble with the following
two commands
1.I am running a simple 1 line script "read.table(file="C:\\Document
and Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get
is "Error in file (file, "r"): cannot
open the connection In addition warning message In file (file, "r"):
cannot open file'C:\Document and
Settings\All Users\Desktop\colon cancer..txt
2.I am running the simple 1 line script print (file="C:\\Document and
Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get is
"error in print.default (file="C:\\
Document and Settings\\All Users\\Desktop\\colon cancer.txt"): argument x
is missing,with no default
I am not sure what I am supposed to enter as argument x.
Any help would be greatly appreciated
paul
[[alternative HTML version deleted]]
This email message, including any attachments, is for th...{{dropped:6}}
Dear Paul, Probably what is happening is that the file is not located where you're telling it to R (did you move it recently?). Do you have headers in your data set? If so, you can try mydata=read.table(file="C:\\Document and Settings\\All Users\\Desktop\\colon cancer.txt",header=TRUE) otherwise, change header=TRUE by header=FALSE. Both should do the work. To go deep on the syntax and options in read.table, see ?read.table. Also you can check ?scan and its friends. HTH, Jorge On Mon, Jun 2, 2008 at 2:33 PM, Paul Adams <pma3622@yahoo.com> wrote:> Hello to everyone, > I am new to programming in R and am having trouble with the following > two commands > 1.I am running a simple 1 line script "read.table(file="C:\\Document and > Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get > is "Error in file (file, "r"): cannot > open the connection In addition warning message In file (file, "r"): cannot > open file'C:\Document and > Settings\All Users\Desktop\colon cancer..txt > > 2.I am running the simple 1 line script print (file="C:\\Document and > Settings\\All Users\\Desktop\\colon cancer.txt) and the error message I get > is "error in print.default (file="C:\\ > Document and Settings\\All Users\\Desktop\\colon cancer.txt"): argument x > is missing,with no default > I am not sure what I am supposed to enter as argument x. > > Any help would be greatly appreciated > paul > > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >[[alternative HTML version deleted]]