Skip to content

Instantly share code, notes, and snippets.

@MichaelChirico
Created April 4, 2016 21:36
Show Gist options
  • Save MichaelChirico/f75d811de84284e1ca356ed67ac2cce2 to your computer and use it in GitHub Desktop.
Save MichaelChirico/f75d811de84284e1ca356ed67ac2cce2 to your computer and use it in GitHub Desktop.
DT <- structure(list(sport = c("NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL", "NHL",
"NHL", "NHL", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA", "NBA",
"NBA", "NBA", "NBA", "NBA", "NBA", "NBA"), season = c(1918L,
1919L, 1920L, 1921L, 1922L, 1923L, 1924L, 1925L, 1926L, 1927L,
1928L, 1929L, 1930L, 1931L, 1932L, 1933L, 1934L, 1935L, 1936L,
1937L, 1938L, 1939L, 1940L, 1941L, 1942L, 1943L, 1944L, 1945L,
1946L, 1947L, 1948L, 1949L, 1950L, 1951L, 1952L, 1953L, 1954L,
1955L, 1956L, 1957L, 1958L, 1959L, 1960L, 1961L, 1962L, 1963L,
1964L, 1965L, 1966L, 1967L, 1968L, 1969L, 1970L, 1971L, 1972L,
1973L, 1974L, 1975L, 1976L, 1977L, 1978L, 1979L, 1980L, 1981L,
1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L,
1991L, 1992L, 1993L, 1994L, 1995L, 1996L, 1997L, 1998L, 1999L,
2000L, 2001L, 2002L, 2003L, 2004L, 2006L, 2007L, 2008L, 2009L,
2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2016L, 2016L, 2015L,
2014L, 2013L, 2012L, 2011L, 2010L, 2009L, 2008L, 2007L, 2006L,
2005L, 2004L, 2003L, 2002L, 2001L, 2000L, 1999L, 1998L, 1997L,
1996L, 1995L, 1994L, 1993L, 1992L, 1991L, 1990L, 1989L, 1988L,
1987L, 1986L, 1985L, 1984L, 1983L, 1982L, 1981L, 1980L, 1979L,
1978L, 1977L, 1976L, 1975L, 1974L, 1973L, 1972L, 1971L, 1970L,
1969L, 1968L, 1967L, 1966L, 1965L, 1964L, 1963L, 1962L, 1961L,
1960L, 1959L, 1958L, 1957L, 1956L, 1955L, 1954L, 1953L, 1952L,
1951L, 1950L), gini = c(0.206896551724138, 0.172839506172839,
0.239583333333333, 0.145833333333333, 0.130208333333333, 0.135416666666667,
0.125, 0.175925925925926, 0.151927437641723, 0.144090909090909,
0.139545454545454, 0.145909090909091, 0.186363636363637, 0.179090909090909,
0.06640625, 0.0982510288065844, 0.0982510288065844, 0.130144032921811,
0.0787760416666667, 0.0950520833333333, 0.14453125, 0.143707482993197,
0.173469387755102, 0.154761904761905, 0.106292517006803, 0.101111111111111,
0.208888888888889, 0.198888888888889, 0.0922222222222223, 0.117592592592593,
0.102777777777778, 0.0907407407407407, 0.0904761904761906, 0.170634920634921,
0.138888888888889, 0.088888888888889, 0.13015873015873, 0.153174603174603,
0.124603174603175, 0.116666666666667, 0.111904761904762, 0.0777777777777779,
0.103968253968254, 0.143650793650794, 0.153174603174603, 0.103968253968254,
0.111904761904762, 0.115079365079365, 0.127777777777778, 0.123015873015873,
0.0868993993993995, 0.130482456140351, 0.142361111111111, 0.161172161172161,
0.168498168498168, 0.159655448717949, 0.153245192307692, 0.172453703703704,
0.18070987654321, 0.157793209876543, 0.172608024691358, 0.143771626297578,
0.125566893424036, 0.131916099773242, 0.133163265306122, 0.144104308390023,
0.147165532879818, 0.131292517006803, 0.132823129251701, 0.0837301587301587,
0.103004535147392, 0.102267573696145, 0.0941043083900226, 0.115702947845805,
0.101601239669421, 0.148354828042328, 0.110524091293322, 0.122596153846154,
0.124531835205992, 0.0857627363255881, 0.10676143743686, 0.107062799023052,
0.10619442797866, 0.114975471210948, 0.0942657884540876, 0.0987253027405991,
0.100307101727447, 0.100024322023592, 0.0981028821597955, 0.0632259638848218,
0.0836372477510333, 0.0775685138234939, 0.0795188006287025, 0.0714009661835748,
0.0988764044943821, 0.090266232983978, 0.0902386117136658, 0.0466089022192757,
0.186484085204682, 0.183483323334, 0.177168188787414, 0.175002777222333,
0.172387810895512, 0.181173333333333, 0.18081683443326, 0.194176720211513,
0.189708202769073, 0.146243082872191, 0.151386666666667, 0.171590126419161,
0.152958077451825, 0.158906064209275, 0.154673008323425, 0.172967933579248,
0.179147703764998, 0.176646848989299, 0.211167952129873, 0.215218828318567,
0.191159230397904, 0.182128943758573, 0.197216254701994, 0.175092654316416,
0.178378096594261, 0.177841421897418, 0.192891061567456, 0.178599887991039,
0.174449952169754, 0.169550853159753, 0.158451249985823, 0.161375091217762,
0.126982686585223, 0.178367116989379, 0.167719688290475, 0.179106847202377,
0.168313600423025, 0.113690092413497, 0.122717767730951, 0.107346756669669,
0.113753086419753, 0.126296296296296, 0.14812098230658, 0.219153810482894,
0.207387720354644, 0.154121938221105, 0.130930275266799, 0.165401179760374,
0.183611111111111, 0.17531012404962, 0.143886667653882, 0.170108816344659,
0.178982180759169, 0.172614640406733, 0.178202186196856, 0.150368657835541,
0.196830457614404, 0.1571875, 0.119873718429607, 0.0529375000000001,
0.0608124999999999, 0.0920000000000001, 0.151506172839506, 0.19981981981982,
0.13084, 0.127030123323674, 0.193563180055864), five_yr_ma = c(0.20643979707677,
0.191288181140911, 0.179072211579395, 0.164776234567901, 0.155208333333333,
0.142476851851852, 0.14369567271353, 0.146472187865045, 0.147297945440803,
0.151479763622621, 0.153567305710163, 0.159, 0.143463068181818,
0.135204183034044, 0.125672570613543, 0.114428649925178, 0.0943656764403293,
0.100094843106996, 0.109350887345679, 0.118442178183002, 0.12710724914966,
0.142304421768707, 0.144552508503401, 0.135868480725624, 0.148904761904762,
0.153988662131519, 0.141480725623583, 0.143740740740741, 0.144074074074074,
0.120444444444444, 0.0987619047619048, 0.114444444444444, 0.118703703703704,
0.115925925925926, 0.123809523809524, 0.136349206349206, 0.127142857142857,
0.122698412698413, 0.127301587301587, 0.116825396825397, 0.106984126984127,
0.110793650793651, 0.118095238095238, 0.116507936507937, 0.123333333333333,
0.125555555555556, 0.122380952380952, 0.116349206349206, 0.112935435435435,
0.116650974282553, 0.122107323488902, 0.128786200167779, 0.137882659264238,
0.152433869127948, 0.156986416361416, 0.163004934879935, 0.166912477954145,
0.16477148622982, 0.167362001424501, 0.165467288222479, 0.156089926166545,
0.146331170812552, 0.141405181898467, 0.1357044386382, 0.136383219954648,
0.137528344671202, 0.137709750566893, 0.127823129251701, 0.119603174603175,
0.11062358276644, 0.103185941043084, 0.0997619047619047, 0.103336120949757,
0.112406179528744, 0.11405748304818, 0.119755852139406, 0.121521629611444,
0.118353928942677, 0.110035250821583, 0.109342992367529, 0.10606264719403,
0.104151374395022, 0.105851984820721, 0.104244757881469, 0.102893618422348,
0.101659597231335, 0.0982850794211043, 0.0920771145072512, 0.089059503509338,
0.0845117859285474, 0.0804106816495694, 0.0750702984543253, 0.0822003865762373,
0.0835261836228263, 0.0860602032008606, 0.0794782235189753, 0.0814975378528254,
0.0757045823056398, 0.182378532442032, 0.180534593637107, 0.178905237088788,
0.177843086714519, 0.177309788934371, 0.18071149521919, 0.183652580328538,
0.178423634723874, 0.172466301390541, 0.170620959787721, 0.162377231235783,
0.156216803523824, 0.15790278861407, 0.162219041996586, 0.163730557465754,
0.168468311773249, 0.178920689357369, 0.191029853356397, 0.194668112720128,
0.195264360718843, 0.199378241861382, 0.192163182298691, 0.184795035953829,
0.182131474253732, 0.184283897815509, 0.180560624473318, 0.180432084043985,
0.178666635357084, 0.174788600974765, 0.168485406904826, 0.158161966623663,
0.158945399587588, 0.158579166613732, 0.162710286057043, 0.164097987898096,
0.161439469063751, 0.150309599212065, 0.138235012887904, 0.125164260731379,
0.116760799906033, 0.12364697788465, 0.142934186435038, 0.162942379172033,
0.171016149532304, 0.171942945326404, 0.175398984817163, 0.168290444942807,
0.161874925681802, 0.159827871568357, 0.167663579783929, 0.170379779983688,
0.168180485842813, 0.16875889827226, 0.170055296308592, 0.175399624562541,
0.171040688410707, 0.160492504015282, 0.13543956677591, 0.117528335208802,
0.0965622436859215, 0.0954259782538228, 0.111415198531865, 0.126995698531865,
0.1402392231966, 0.160551859207773, 0.162813280799839, 0.150477767793179
)), .Names = c("sport", "season", "gini", "five_yr_ma"), row.names = c(NA,
-165L), class = c("data.table", "data.frame"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment