[R] Parliament Seats Graph

Stefan Petersson stefan at inizio.se
Fri Sep 12 13:28:15 CEST 2014


Yes. That's correct. The main problem is to solve a matrix where the
colSums and rowSums are known. Credits to dwinsemius at comcast.net for
pointing out the function "r2dtable" to me. Just feed it with the
known margins and the number of matrices You want. And Bob is Your
uncle!

Look at the thread "Margins to fill matrix" that I started on the subject.




2014-09-12 13:18 GMT+02:00 Barry Rowlingson <b.rowlingson at lancaster.ac.uk>:
> On Fri, Sep 12, 2014 at 11:25 AM, Jim Lemon <jim at bitwrit.com.au> wrote:
>
>> I can see how you would plot the points going from right to left (the easy
>> way), by plotting the next point on the arc with the least increase in
>> angle from the last point plotted. If this is the way you have worked out, I
>> think all that you have to do is to turn the party affiliation into a factor (if
>> it is not already) and plot the points by the sorted numeric value of the
>> factor. You will probably want to adjust the levels to some political
>> dimensions before doing the sort.
>
>  I'm interested in how you get exactly N seats in M rows that look as
> neat as that. My eyes are going funny trying to count the dots in each
> arc but there must be some nice algorithm for generating a sequence
> that sums to N, has M elements, and has a small variable difference
> between the row sizes to constrain the sum...
>
>  Or am I overthinking this?
>
> Barry



More information about the R-help mailing list