[R] while loop problems

2011-05-31 Thread Alon Honig
Hi , i am trying to get this loop in my r program to work but it is not giving me the results that I desire. I am trying to model an insurance contract where there are n securities that have a fixed likelihood of default vector(data[i,2]) and a payout vector(data[i,1]). i need to price the value o

[R] extract integers from string

2011-05-12 Thread Alon Honig
I have a vector with a long list of sentences that contain integers. I would like to extract the integers in a manner such that they are separate and manipulatable. for example: x[i] <- "sally has 20 dollars in her pocket and 3 marbles" x[i+1] <- "30 days ago john had a 400k house" all sentences