[R] Precision in estimating log

2006-05-19 Thread Gichangi, Anthony
Hi R-users, I have the following code: f -function(x,p)sqrt(-(x^2)-2*log(1-p)) r1 -sqrt(-2*log(1-0.95)) r2 -sqrt(-2*log(0.05)) on executing i get the following results f(r1,0.95) [1] 0 f(r2,0.95) [1] NaN Warning message: NaNs produced in: sqrt(-(x^2) - 2 * log(1 - p)) I tried to track

Re: [R] loop

2005-12-29 Thread Gichangi, Anthony
Your loop will store results of count =6 because every time the loop executes the results are put in qw so you replace the previous results. On the other hand the results of count=1 is not extracted you basicaly start at 2. My advice is you initialize qw before the loop and stack the results one

Re: [R] How define global Variable?

2005-11-28 Thread Gichangi, Anthony
In your current definitions a can not change value to new unless you type a-test(). If you want the results of the test to be global then you add something like this test -function()a-new This will always replace the existing value of a once you type test() regards Anthony- Original