Thanks. That works!
min() function didn't vectorized but "abs( )", "pmin" or "+ /-" did.
On Tue, Feb 12, 2013 at 12:18 PM, William Dunlap wrote:
> integrate() want a vectorized function, one such that
> length(f(x))==length(x).
> Use pmin or pmax instead of min or max.
>
> Bill Dunlap
> Spotfir
integrate() want a vectorized function, one such that length(f(x))==length(x).
Use pmin or pmax instead of min or max.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of
use pmin instead of min.
hth
Matthias
On 12.02.2013 16:41, dan wang wrote:
Hi All,
Can any one help to explain why min and max function couldn't work in the
integrate function directly.
For example, if issue following into R:
integrand <- function(x) {min(1-x, x^2)}
integrate(integrand, lower
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
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
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
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
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
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
li li-13 wrote:
>
> Yes, f2 is the function I wanted to write. I tried to do use "Vectorize"
> function to f1, it did not work.
>> f2 <- function(x)
> + {
> + integrate(Vectorize(f1,vectorize.args =p), lower=0,upper=1, x)
> + }
>> f2(c(2,3))
> Error in Vectorize(f1, vectorize.ar
f Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: li li
Date: Saturday, December 5, 2009 7:13 pm
Subject: Re: [R] integrate function
To: David Winsemius
Cc: r-help@r-project.org
> Thank you very much for your reply!
>
__
>
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology
> School of Medicine
> Johns Hopkins University
>
> Ph. (410) 502-2619
> email: rvarad...@jhmi.edu
>
>
> - Original Message -
>
rom: li li
Date: Saturday, December 5, 2009 7:13 pm
Subject: Re: [R] integrate function
To: David Winsemius
Cc: r-help@r-project.org
> Thank you very much for your reply!
> It is not an assignment.
> What I want to do is what we often do. If we have a bivariate
> function of x
&g
Thank you very much for your reply!
It is not an assignment.
What I want to do is what we often do. If we have a bivariate function of x
and p,
I first fix x and integrate out p. Then the resultant function is only in
terms of x.
Here f1 is a bivariate function of x and p.
> f1 <- function (p,x
On Dec 5, 2009, at 4:59 PM, li li wrote:
Hello,
I have some trouble in terms of using integrate function in R.
f1 is a function of p and x where x is supposed to be a vector. (See
the
code).
Then I want to write function f2 which is a function of the vector
x after I integrate out p.
Can
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
?integrate, it is in the documentation
Bhargab Chattopadhyay wrote:
Hi!
Can anyone please let me know what numerical integration procedure does the
integrate function in package stats follow?
Thank you in advance
Shant
[[alternative HTML version deleted]]
.. but it turned out he wanted;
integrate()$value
--
David Winsemius
On Dec 22, 2008, at 6:26 PM, David Winsemius wrote:
If these messages you're hearing are warnings, then the answer might
be:
?warnings
-- David Winsemius
On Dec 22, 2008, at 6:07 PM, glenn roberts wrote:
Quick One
If these messages you're hearing are warnings, then the answer might be:
?warnings
--
David Winsemius
On Dec 22, 2008, at 6:07 PM, glenn roberts wrote:
Quick One if any one can help please.
On use of integration function ‘integrate’; how do I get the
function to
return just the value w
19 matches
Mail list logo