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.nabbl
Hi,
I have a matrix
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]131131123 2
[2,]131211122 1
[3,]122321112 1
[4,]321113121
Hello,
For reasons unclear to me I am getting above error message when I change the
value of b in the following code:
rm(list=ls())
library("Hmisc")
set.seed(4) #seems to have an effect on t(apply
b=10
pop.props = c(0.6,0.2,0.2)
x=matrix(pop.props,nrow=nn,ncol=length(pop.
"Most likely reason is that the number of unique values in the rows of
habs is not the same."
Yes, I think that is the problem, thank you.
How would I write the code to include 0s in the matrix,
ie, I want to have a record of when 1, 2, or 3 does not get sampled,
to come up with a frequency of e
4 matches
Mail list logo