Re: [R] Find the first occurrence in a list

2016-03-14 Thread Bert Gunter
No. 1.Avoid using the name "data" -- it's already a commonly used function in R. 2. Why do you want it to be a list instead of a vector? Is there a good reason for this? Consider: > d<- c(rep(0, 20), rep(1, 340)) > which(d>0)[1] [1] 21 3. If you haven't already done so, spend some time with an

[R] Find the first occurrence in a list

2016-03-14 Thread Glenn Schultz
All, I am looking to find the first principal payment date on structured MBS cash flow. I am testing the below to make into a function the correct index is returned. I am a little unsure. Is this the correct way to think about this problem or is there something already in R that can help? Gl