[R] error in dat

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Mon Jun 16 10:32:21 CEST 2008

Paul Adams wrote:
> Hello everyone,
> I have the following code which keeps giving me an error.
> The code is:
> dat<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\eisen.txt",header=T,row.names=1,blank.lines.skip=F,na..strings="NA")
> dimnames(dat)((1)) <-as.character(dat(,1))
> dat<-dat(,-1)
> dat<-as.data.frame(dat)
> file.show(file="C:\\Documents and Settings\\Owner\\My Documents\\eisen.txt")
> ann<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\eisenClasses.txt",header=T)
> file.show(file="C:\\Documents and Settings\\Owner\\My Documents\\eisenClasses.txt")
> cl<-as.character(ann[,2])
> dat<-dat[,cl]
> gc<-cl(1:19)
> act<-cl(20:39)
> x<-as.numeric(dat(2000,gc))
> y<-as.numeric(dat(2000,act))
> x<-x(!is..na(x))
> y<-y(!is.na(y))
> xy.list<-list(x,y)
> boxplot(xy.list,col=c("red","blue"),main="Gene 2000")
> The error is:   "error in eval .with.vis(expr, envir, enclos)  :
> could not find function "dat"

you misuse the syntax, check the docs.  with 'dat(...)' r tries to apply
dat, but dat is a data frame, and is thus not applicable.  what you want
is dat[...].

you can argue that the error message is misleading;  unless you defined
one, r cannot find a function named 'dat', but it does find your data
frame, and it should complain about its non-applicability. 


More information about the R-help mailing list