dear: when I read a Excel file(exp-11),The R project give me a error ,Just like this: ??'datafile'> write.foreign("exp-11.xls")???list(df = df, datafile = datafile, codefile = codefile) : ??'datafile'> write.foreign("exp-11.xls")???list(df = df, datafile = datafile, codefile = codefile) : ??'datafile'> write.foreign("exp-11.xls")???list(df = df, datafile = datafile, codefile = codefile) : ??'datafile'> mydata<-scan("exp-11.xls",what=list(sex="",smo="",comp="",TNum="",TG="",Endo="",Y="",HeT="",Year="",TuS="")+ + + mydata ??: ????? ? "mydata"> mydata??: ?????'mydata' Can you tell me why the R project can't read the file,thank you ! truly yours
The function write.foreign is used to export data to other statistical software. To read data from Excel, R has : library(foreign) read.xport("name.xpt") or library(gdata) read.xls() ----- A R learner. -- View this message in context: http://r.789695.n4.nabble.com/a-problem-tp2308667p2308676.html Sent from the R help mailing list archive at Nabble.com.
On 31.07.2010 07:17, Wu Gong wrote:> > The function write.foreign is used to export data to other statistical > software. To read data from Excel, R has : > > library(foreign) > read.xport("name.xpt")No, since it is intended to read SAS XPORT files... Please also quote the original question, otherwise nobody can follow what is going on. Best, Uwe Ligges> > or > library(gdata) > read.xls() > > ----- > A R learner.
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html which suggests to use sensible subject lines. Please read the manual R Data Import/Export which contains remarks about Excel. Best, Uwe Ligges On 31.07.2010 06:08, ???? wrote:> dear: > when I read a Excel file(exp-11),The R project give me a error ,Just like this: > ????'datafile' >> write.foreign("exp-11.xls") > ??????list(df = df, datafile = datafile, codefile = codefile) : > ????'datafile' >> write.foreign("exp-11.xls") > ??????list(df = df, datafile = datafile, codefile = codefile) : > ????'datafile' >> write.foreign("exp-11.xls") > ??????list(df = df, datafile = datafile, codefile = codefile) : > ????'datafile' >> mydata<-scan("exp-11.xls",what=list(sex="",smo="",comp="",TNum="",TG="",Endo="",Y="",HeT="",Year="",TuS="") > + > + > + mydata > ????: ?????????? ?? > "mydata" >> mydata > ????: ??????????'mydata' > Can you tell me why the R project can't read the file,thank you ! > truly yours > > > > > ______________________________________________ > R-help at 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.