here's the code to generate the matrix set.seed(1) types = c(1,2,3) n=5 p=1 pop.props = c(0.6,0.2,0.2) x=matrix(pop.props,nrow=n,ncol=length(pop.props), byrow=T) b=10 habs = rMultinom((x),b) print(habs)
-- View this message in context: http://r.789695.n4.nabble.com/determine-frequencies-in-a-matrix-by-row-tp3581733p3581752.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.