Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Peter Ehlers
On 2012-04-06 07:19, Navin Goyal wrote: Thank you so much for your help Berend. I did not see that my code had a typo and it was thus wrongly written ( I overlooked the i that was supposed to be actually 1) instead of for (q in *1*:length(comb1$ID)) I had it as for (q in *i*:leng

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Navin Goyal
Thank you so much for your help Berend. I did not see that my code had a typo and it was thus wrongly written ( I overlooked the i that was supposed to be actually 1) instead of for (q in *1*:length(comb1$ID)) I had it as for (q in *i*:length(comb1$ID)) It works correctly as expect

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Berend Hasselman
On 06-04-2012, at 13:14, Navin Goyal wrote: > Apologies for the lengthy code. > I tried a simple (and shorter) piece of code (pasted below) and it still > gives me the same error for last few rows. Is this a bug or am I doing > something totally wrong? Could anyone please provide some help/poi

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Navin Goyal
Apologies for the lengthy code. I tried a simple (and shorter) piece of code (pasted below) and it still gives me the same error for last few rows. Is this a bug or am I doing something totally wrong? Could anyone please provide some help/pointers ? PS. beta0 was fixed to 0.001 in the previous c

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-06 Thread Navin Goyal
Apologies for the lengthy code. I tried a simple (and shorter) piece of code (pasted below) and it still gives me the same error for last few rows. Is this a bug or am I doing something totally wrong? Could anyone please provide some help/pointers ? PS. beta0 was fixed to 0.001 in the previous c

Re: [R] integrate function - error -integration not occurring with last few rows

2012-04-05 Thread Berend Hasselman
On 06-04-2012, at 00:55, Navin Goyal wrote: > Hi, > I am using the integrate function in some simulations in R (tried ver 2.12 > and 2.15). The problem I have is that the last few rows do not integrate > correctly. I have pasted the code I used. > The column named "integral" shows the output from

[R] integrate function - error -integration not occurring with last few rows

2012-04-05 Thread Navin Goyal
Hi, I am using the integrate function in some simulations in R (tried ver 2.12 and 2.15). The problem I have is that the last few rows do not integrate correctly. I have pasted the code I used. The column named "integral" shows the output from the integrate function. The last few rows have no integ

Re: [R] integrate() function error

2009-10-22 Thread andrew
Change e2 to the following and it works e2 <- function(a) a^2/2 The reason it doesn't is that e2 must be able to handle vector inputs correctly. Your original function does not do this. from ?integrate f - an R function taking a numeric first argument and returning a numeric vector of the sam

[R] integrate() function error

2009-10-22 Thread fuzuo xie
This is my code , when i run it ,error happed . can you tell me what's the reason and modify it ?thank you very much !! the error is "evaluation of function gave a result of wrong length" e2<-function(a) integrate(function(x) x,lower=0,upper=a)$value integrate(e2,lower=0, upper=0.5)$value