Hello everyone, I am trying to plot a boxplot but am coming up with the error : "could not find function dat" I have used the following code. dat<-read.table(file="C:\\Documents and Settings\\.......txt",header=T,row.names=1,blank.lines.skip=F,na.strings="NA") file.show(file="C:\\Documents and Settings\\......txt") data<-read.table(file="C:\\Documents and Settings\\.....txt",header=T) file.show(file="C:\\Documents............txt") gc<-dat(1:19) act<-dat(20:39) x<-as.numeric(dat(100,gc)) y<-as.numeric(dat(100,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 100") I can not figure out what I am doing wrong with function dat. Any help would be appreciated. Paul [[alternative HTML version deleted]]
What is this statement supposed to do: gc<-dat(1:19) You are trying to call the function 'dat' with a vector of 19 values. Is this what you intended? If the function 'dat' does not exist, that is why you are getting the error. On Sat, Jun 21, 2008 at 2:46 AM, Paul Adams <pma3622 at yahoo.com> wrote:> Hello everyone, > I am trying to plot a boxplot but am coming up with the error : > "could not find function dat" I have used the following code. > dat<-read.table(file="C:\\Documents and Settings\\.......txt",header=T,row.names=1,blank.lines.skip=F,na.strings="NA") > file.show(file="C:\\Documents and Settings\\......txt") > data<-read.table(file="C:\\Documents and Settings\\.....txt",header=T) > file.show(file="C:\\Documents............txt") > > gc<-dat(1:19) > act<-dat(20:39) > x<-as.numeric(dat(100,gc)) > y<-as.numeric(dat(100,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 100") > I can not figure out what I am doing wrong with function dat. Any help would be > appreciated. > Paul > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
The problem is dat is a data object, not a function. You used the syntax for a function "dat(1:19)" What you probably want is: gc <- dat[,1:19] act <- dat[,20:39] That will select columns 1 through 19 and put them into the object gc, and act will get columns 20 through 39. Is that what you want? It is hard to tell because we don't have access to the data file read into the object "dat" using the read.table function. BTW, is this a homework assignment? ;-) Paul Adams-8 wrote:> > Hello everyone, > I am trying to plot a boxplot but am coming up with the error : > "could not find function dat" I have used the following code. > dat<-read.table(file="C:\\Documents and > Settings\\.......txt",header=T,row.names=1,blank.lines.skip=F,na.strings="NA") > file.show(file="C:\\Documents and Settings\\......txt") > data<-read.table(file="C:\\Documents and Settings\\.....txt",header=T) > file.show(file="C:\\Documents............txt") > > gc<-dat(1:19) > act<-dat(20:39) > x<-as.numeric(dat(100,gc)) > y<-as.numeric(dat(100,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 100") > I can not figure out what I am doing wrong with function dat. Any help > would be > appreciated. > Paul > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > >-- View this message in context: http://www.nabble.com/boxplot-problem-tp18041574p18052164.html Sent from the R help mailing list archive at Nabble.com.