[R] Not the same length
    varin sacha 
    v@r|n@@ch@ @end|ng |rom y@hoo@|r
       
    Wed Sep 18 22:29:58 CEST 2019
    
    
  
Argggg ! What a pity, I have not seen it ! Many thanks !
Le mercredi 18 septembre 2019 à 19:07:42 UTC+2, peter dalgaard <pdalgd using gmail.com> a écrit : 
Redefining n is probably not a good idea...
[...snip...]
> m <-runif(n, 0, 5)
> n <-rnorm(n, 2, 3) 
Oops! n is now a vector of length 2000.
[...snip...]
> y_obs <- y_model +c( rnorm(n*0.97, 0, 0.1), rnorm(n*0.03, 0, 0.5) )
now length(n*0.97) == 2000 > 1, so rnorm(n*0.97, ...) gets you a length 2000 vector (check ?rnorm), and  c() of 2 of those is a vector of length 4000.
[...etc...]
>  
-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com
    
    
More information about the R-help
mailing list