[tech-spec] Re: R Gedankenexperiment

  • From: Henry Carstens <carstens@xxxxxxxxxxxxxxxxxxxxx>
  • To: tech-spec@xxxxxxxxxxxxx
  • Date: Sun, 10 Oct 2004 06:27:59 -0700

On Oct 5, 2004, at 12:17 PM, Steve Wisdom wrote:

> exit <- unlist( sapply( entry, function(x) min( which( event> x))))


#Find what happens the next 'day' for all days greater than 15

a<-10:20
b<-20:30

entries<-which(a > 15)

exits<-b[entries]

exits; plot(exits)


The original code is doing something more clever but I'm missing it:

big<-function(x){
        which(x > 15)
}

#the resulting list is correct:
sapply(a,big)

#but the next step doesn't get me where I want to be:
exits<-b[unlist(sapply(a,big))]


Hints?


Other related posts: