[R] how can generate h(u)=min{a,log(u)} for 0<u<1 in R ?

Gabor Grothendieck ggrothendieck at gmail.com
Mon Dec 21 12:06:47 CET 2009


Use pmin like this:

> set.seed(123)
> pmin(-0.1, log(runif(25)))
 [1] -1.2462628 -0.2378700 -0.8940966 -0.1244104 -0.1000000 -3.0888020
 [7] -0.6384592 -0.1138195 -0.5952313 -0.7839153 -0.1000000 -0.7911258
[13] -0.3892415 -0.5575096 -2.2737578 -0.1055550 -1.4020672 -3.1686692
[19] -1.1149834 -0.1000000 -0.1170516 -0.3670090 -0.4454955 -0.1000000
[25] -0.4220431


On Mon, Dec 21, 2009 at 5:16 AM,  <khazaei at ceremade.dauphine.fr> wrote:
> Hello,
>
> How can generate a sample from h(u)=min{a,log(u)} for 0<u<1   in R,please?
>
> thank you
> khazaei




More information about the R-help mailing list