[R] Vectorize (scalar) function

R. Michael Weylandt michael.weylandt at gmail.com
Sat Mar 24 03:28:18 CET 2012


? Vectorize

is the one you need here.

primitives are probably more subtle than you need and there's no such
thing as a "scalar" function by that name.

Michael

On Fri, Mar 23, 2012 at 5:12 PM, casperyc <casperyc at hotmail.co.uk> wrote:
> Hi all,
>
> myint=function(mu,sigma){
>        integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
> }
>
> x=seq(0,50,length=3000)
> x=x[-1]
> plot(x,myint(4,x))  # not working yet
>
> I think I have to 'Vectorize' it somehow?
>
> What's a scalar function? and a primitive function?
>
> Thanks.
>
> casper
>
>
>
>
> -----
> ###################################################
> PhD candidate in Statistics
> School of Mathematics, Statistics and Actuarial Science, University of Kent
> ###################################################
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Vectorize-scalar-function-tp4500181p4500181.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list