[R] Margins to fill matrix

Stefan Petersson stefan at inizio.se
Thu Sep 11 10:47:10 CEST 2014


Hi,

I have two vector of margins. Now I want to create "fill" matrix that
reflects the margins.

 seats <- c(17,24,28,30,34,36,40,44,46,50)
 mandates <- c(107,23,24,19,112,19,25,20)

Both vectors adds up to 349. So I want a 10x8 matrix with row sums
corresponding to "seats" and column sums corresponding to "mandates".



More information about the R-help mailing list