Hi Brook,
Usually people do this as you have it except for
N[i, j] ~ dpois(lambda[i])
so N is a matrix holding a ragged array. The number of columns will be max(n).
At this point I sometimes suggest looking around our web site's (
r-nimble.org) examples and user manual in case you haven't already, but we are currently caught up in a web site outage with our host institution.
An alternative is to make N a vector and use nested indexing for lambda. Then you would have
for(i in 1:m) {lambda[i] ~ dnorm(mu, sigma)}
for(i in 1:N) {y[i] ~ dpois(lambda[group[i]])}
where you provide the index vector `group` in the constants list.
HTH
Perry