Tuesday, May 19, 2009

More Difficult Than It Should Be

Yesterday I was a reading an article about the Supreme Court and saw that Justice Stevens just turned 89 years old. I was a little surprised by this, thinking he was a young 86 years old. I wondered if he was the oldest justice to ever serve on the court and if not, what was his rank. This is something the net should be able to tell me but it turns out it wasn't so easy.

I first tried the wikipedia page on the Supreme Court but that had the serving justices current ages but not that of the previous justices. Another page could tell me that Justice Holmes was the oldest justice but not where Stevens ranked.

A couple of Google searches didn't yield much info.

Wolfram Alpha should be able to do this but it didn't have the data and I've found it's not very good at showing a list of rankings. It sometimes says things like the US is the 3rd ranked country in terms of area, but I haven't been able to figure out how to get a list of all countries ranked by area.

Wikipedia lists all the justices including their birth and death dates and times of service. So it shouldn't be hard to turn this into a spreadsheet and sort it as I wanted. Not so much.

First I cut and pasted it into an emacs buffer to run some text macros to turn it into a csv file. The dates had newlines in them so I had to collapse those to one row per justice. Easy enough but I found that rows had varying number of fields since there was a column for term as chief justice which was mostly "(none)" but sometimes had a date range which turned into two fields. I decided to remove that column and all the ones to the right since I didn't care about that data. Also since the dates were of the form "August 21, 1798" I choose semi-colon as the separator.

I've never been much of a spreadsheet user but have been playing with Apple's Numbers from iWork. I tried importing my new csv file but found that Numbers couldn't deal with ; as separators. So I imported into Excel which I knew could. I then had problems convincing it to treat the date columns as actual dates instead of text. It didn't help that for a few records we don't know an actual date, just a year.

Then in Excel I wanted to do the math, so I created a column with a formula that was the end date of their service as justice minus their birthdate. That doesn't work because Excel doesn't work with dates before 1900!

So I saved it as an xls file and then opened it in Numbers. It dealt with the "old" dates and I could do the math, but the result showed as a number of days which wasn't very intuitive. I tried just dividing by 365 but that didn't work. I then had to learn about the YEARFRAC function to do the date arithmetic which did what wanted though I'm not sure it accurately dealt with leap years in the math, though I didn't care about that detail. I also found out about the TODAY() function and inserted it where wikipedia had "(present)".

Anyway, I found out my answer. Stevens is the 2nd oldest serving justice and there have been 13 to have served into their 80s.

90.8 Oliver Wendell Holmes, Jr.
89.1 John Paul Stevens
87.6 Roger Brooke Taney
85.7 Harry Andrew Blackmun
85.6 Hugo Lafayette Black
84.2 William Joseph Brennan, Jr. *
83.2 Thurgood Marshall
82.3 Louis Dembitz Brandeis
82.1 Gabriel Duvall
81.4 Joseph McKenna
81.1 Stephen Johnson Field
80.9 William Hubbs Rehnquist
80.1 Samuel Nelson

I also have a new appreciation for what Wolfram Alpha is trying to do. Even data like this has some consistency problems. I mentioned that for some justices we don't have exact birth dates; there are other problems to. A couple of justices retired and then returned to the court as chief justice so there's a gap in their service. Wikipedia also lists their state when they were nominated to the court, but in one case, Rehnquist was nominated as a justice from AZ and as chief from VA, the only justice to need two states for this field, though I'm not sure if they just don't list a different state for other justices elevated to chief.

FYI, the ages of the current justices are:

89.1 John Paul Stevens
76.2 Ruth Bader Ginsburg
73.2 Antonin Gregory Scalia
72.8 Anthony McLeod Kennedy
70.8 Stephen Gerald Breyer
69.7 David Hackett Souter
60.9 Clarence Thomas
59.1 Samuel Anthony Alito
54.3 John Glover Roberts, Jr.

I'll be very impressed when Alpha can answer "When was the average age of the US Supreme Court the oldest?" It does estimate now that Stevens should live to 94.31 and Scalia to 86.26 though I can't enter anything other than age to improve the estimate.

2 comments:

Megs said...

Great detail of your troubles - wow!

And for future lists, also would be interesting to see who died while a Justice v/s who retired

Howard said...

That the wikipedia list has. And one doesn't fit that data. He was a recess appointment to chief and after serving 6 months was rejected by the senate.