Re: [R] subsets

2011-01-20 Thread Taras Zakharko
Hello Den, your problem is not as it may seem so Ivan's suggestion is only a partial answer. I see that each patient can have more then one diagnosis and I take that you want to isolate patients based on particular conditions. Thus, simply looking for "ah" or "idh" as Ivan suggests will yield p

Re: [R] How to *completely* stop a script after stop()?

2011-01-15 Thread Taras Zakharko
I take you don't use source() to execute your scripts. When using source, stop() aborts the complete script, just as you indent to. -- View this message in context: http://r.789695.n4.nabble.com/How-to-completely-stop-a-script-after-stop-tp3218808p3218823.html Sent from the R help mailing list

Re: [R] Selecting the first occurrence of a value after an occurrence of a different value

2011-01-14 Thread Taras Zakharko
Hi, I'll do something like this (there is probably a nicer way, but this code is what first comes up to my mind) provided your data is in x pos1 <- which(x %in% val1)[1] pos2 <- which(x %in% val2)[which(x %in% val2) > pos1][1] -- View this message in context: http://r.789695.n4.nabbl

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Thank you both for very helpful answers. I have indeed missed the help pages about "(" and now the situation is more clear. > You can use this syntax by defining a function `x<-` <- function(...) {} > and it could be an S3 method, but it is a completely separate object from > x. Unfortunately

[R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function call operator (). While .Primitive("(") exists, whi