Re: [R] writing a simple function

2008-02-13 Thread Roland Rau
Hi, Ben Bolker wrote: > Roland Rau gmail.com> writes: > >> does this do what you want? >> >> overlap <- function(a,b,c,d) { >> all(c:d %in% a:b) >> } >> overlap(1,5,3,4) >> overlap(1,2,3,4) > > Do you really want this to be discrete? How about > > overlap <- function(a,b,c,d) { >ad

Re: [R] writing a simple function

2008-02-13 Thread Ben Bolker
Roland Rau gmail.com> writes: > > does this do what you want? > > overlap <- function(a,b,c,d) { > all(c:d %in% a:b) > } > overlap(1,5,3,4) > overlap(1,2,3,4) Do you really want this to be discrete? How about overlap <- function(a,b,c,d) { ad } (although this assumes that ahttps:

Re: [R] writing a simple function

2008-02-13 Thread Bill.Venables
Your code looks like matlab, but I don't see how it would work even there. The specific problem is the to refer to an array, you do so with square brackets [..] and not round ones, (though your v is not an array, anyway, so your troubles are just starting). Let's tackle what I think may be your p

Re: [R] writing a simple function

2008-02-13 Thread Roland Rau
Hi, mohamed nur anisah wrote: > 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.Pl