[R] writing a simple function

From: mohamed nur anisah <nuranisah_mohamed_at_yahoo.com>
Date: Wed, 13 Feb 2008 06:21:39 -0800 (PST)


Dear lists,    

  any suggestion on how to write a function to return a TRUE if interval [a,b] overlaps the interval [c,d]. I've tried it but an error occur saying that 'could not find function v ; in addition warning message occur'. Below is my codes.Please help me sort this problem as i'm in process of learning of writing a function. Many thanks    

  overlap<-function(m,n){
t=length(m)
v=length(n)
tt=logical(t)
tv=logical(v)
 for(i in 1:m){
  for(i in 1:n){
  if(v(i,j)<=t(i,j)){

     tt=T
     tv=T

   }
  }
 }
k=c(tt,tv)
return(k)
}    

  Regards,
  Anisah        


        [[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. Received on Wed 13 Feb 2008 - 14:40:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Feb 2008 - 16:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive