[R] Running the Loop

2014-02-04 Thread Katherine Gobin
Dear R forum, I have following data.frames dat = data.frame(id = c(1:3), root = c(0.10, 0.20, 0.74), maturity_period = c(20, 155, 428), mtm = c(1000, 1, 10), curve = c(USD, USD, USD)) dat   id root maturity_period   mtm curve 1  1 0.10              20 1e+03   USD 2  2 0.20            

Re: [R] Running the Loop

2014-02-04 Thread arun
Hi Katherine,Not sure if this helps.  I was able to the result after making up some additional conditions into your function. fun1 - function(x){     lst1 - lapply(seq(n-1),function(i){     with(x,if(maturity_period D[i] maturity_period D[i+1]){             

Re: [R] Running a loop of random generated sums

2012-11-09 Thread rlcorp
I also would like to sort the values that are greater than 10 in one vector and less than or equal to 10 in another vector. -- View this message in context: http://r.789695.n4.nabble.com/Running-a-loop-of-random-generated-sums-tp4649013p4649070.html Sent from the R help mailing list archive

Re: [R] Running a loop of random generated sums

2012-11-09 Thread David Winsemius
On Nov 9, 2012, at 9:07 AM, rlcorp wrote: I also would like to sort the values that are greater than 10 in one vector and less than or equal to 10 in another vector. x - 1:20 x[x10] x[x=10] -- David Winsemius, MD Alameda, CA, USA __