Notice that

>mone-3
[1] -8.881784e-16

on my machine so, no, mone is actually less than 3, which truncates to 2.

This is an overcomplicated version of R FAQ 7.31, which is mentioned in the 
posting guide referenced at the end of every R-help message.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

li li <hannah....@gmail.com> wrote:

Hi all. I was having some trouble with a for loop and I found the problem is 
the following. Does anyone have some idea why I got the following R result? 
Since mone is equal to 3, why mu1 only have 2 components? library(MASS) > p0 <- 
seq(0.1, 0.9,by=0.1) > m <- 10 > > > p0 <- p0[7] > > ## data generation > > 
mzero <- p0*m > mone <- m-mzero > mu1 <- rnorm(mone, 0,1) > mu <- 
c(rep(0,mzero), mu1) > > var <- diag(m) > zv <- mvrnorm(n, mu, var) Error in 
mvrnorm(n, mu, var) : incompatible arguments > mone [1] 3 > mu1 [1] -0.08802108 
0.77904786  [[alternative HTML version 
deleted]]_____________________________________________
R-help@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. 


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to