From 502285f31decedfbf5034c3f58d958287da03ef1 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Fri, 29 Mar 2019 21:48:48 -0400 Subject: [PATCH] Computed metrics on player speed and acceleration for each game. --- data_preparation/data/speedData.csv | 799 ++++++++++++++++++++++++++++ data_preparation/dataPrep.R | 36 +- 2 files changed, 826 insertions(+), 9 deletions(-) create mode 100644 data_preparation/data/speedData.csv diff --git a/data_preparation/data/speedData.csv b/data_preparation/data/speedData.csv new file mode 100644 index 0000000..afa6415 --- /dev/null +++ b/data_preparation/data/speedData.csv @@ -0,0 +1,799 @@ +"","gameID","playerID","averageSpeed","accelerationVector" +"1",1,2,0.790156218745573,1.0984886027971 +"2",2,2,1.74421568677905,1.16129889790784 +"3",3,2,1.07787746041134,1.10351847363523 +"4",4,2,1.21107942650256,1.13246482933397 +"5",5,2,0.0137764499693478,1.06474272290467 +"6",6,2,1.94120558109787,1.146865298664 +"7",7,2,1.22020736168799,1.12848585324374 +"8",8,2,1.34394880308456,1.13562836551868 +"9",9,2,1.16234840998408,1.12239524586719 +"10",10,2,1.03789513301476,1.12260389477498 +"11",11,2,1.95249813187896,1.16018587350874 +"12",12,2,0.223656610333639,1.06756021876023 +"13",13,2,0.829283553086806,1.0991314961471 +"14",14,2,0.15852836373719,1.06759394513467 +"15",15,2,1.12074602135577,1.11513380371634 +"16",16,2,0.971054601439169,1.10463881568274 +"17",17,2,0.869261365568522,1.10030018034645 +"18",18,2,1.25156863060178,1.12646920213549 +"19",19,2,1.92233943230709,1.16818424510756 +"20",20,2,0.649062029481435,1.08486694104424 +"21",21,2,0.670886363718549,1.0877274137206 +"22",22,2,1.07041086767478,1.12527024421626 +"23",23,2,1.34733708098004,1.13125329230651 +"24",24,2,1.92233943230709,1.16818424510756 +"25",25,2,0.649062029481435,1.08486694104424 +"26",26,2,0.670886363718549,1.0877274137206 +"27",27,2,1.07041086767478,1.12527024421626 +"28",28,2,1.34733708098004,1.13125329230651 +"29",29,2,0.854015657755256,1.10323072993156 +"30",30,2,1.84124984163638,1.14936689436886 +"31",31,2,1.14213183014974,1.12247088147764 +"32",32,2,0.747148624376757,1.15302465502118 +"33",33,2,0.955682448262175,1.09936692283938 +"34",34,2,0.571048432694349,1.08907791458436 +"35",35,2,0.669725927665975,1.09313578136609 +"36",36,2,0.738101857808688,1.08770291503587 +"37",37,2,0.339206262169712,1.07173976425182 +"38",38,2,1.80606261172781,1.15253356565467 +"39",1,3,1.28589934082386,1.12319736088361 +"40",2,3,1.11919276939115,1.12400349638768 +"41",3,3,1.26526643744858,1.12475879989089 +"42",4,3,1.41843108886165,1.12769556423203 +"43",5,3,1.3952622773171,1.12836112325742 +"44",6,3,0.0211561590516235,1.06010498483615 +"45",7,3,1.40269604443183,1.13471085317652 +"46",8,3,1.57214563065393,1.14071392944187 +"47",9,3,1.37033003104991,1.13296169932273 +"48",10,3,1.35811042459937,1.16220563093959 +"49",11,3,0.0406068795995551,1.05616194835639 +"50",12,3,1.40887168417965,1.12080573606489 +"51",13,3,1.53383759403768,1.12571881100781 +"52",14,3,1.46228698250083,1.12708035940326 +"53",15,3,1.02959031047728,1.13025308248774 +"54",16,3,1.45148020420994,1.12897009153938 +"55",17,3,NA,NA +"56",18,3,NA,NA +"57",19,3,NA,NA +"58",20,3,NA,NA +"59",21,3,NA,NA +"60",22,3,NA,NA +"61",23,3,NA,NA +"62",24,3,NA,NA +"63",25,3,NA,NA +"64",26,3,NA,NA +"65",27,3,NA,NA +"66",28,3,NA,NA +"67",29,3,1.60859397929703,1.13084277780543 +"68",30,3,1.50587829200883,1.12511387973254 +"69",31,3,0.899724012963328,1.1108612448773 +"70",32,3,1.57137036050047,1.13580950623037 +"71",33,3,1.60841771943073,1.13966448786291 +"72",34,3,1.36390732486419,1.13409907143999 +"73",35,3,0.978174287994467,1.10540476529112 +"74",36,3,1.59755311245667,1.13604886115661 +"75",37,3,1.5188695084037,1.12552272191366 +"76",38,3,1.29332494175891,1.12317749322947 +"77",1,4,0.752166129328984,1.13302768044503 +"78",2,4,1.57984902625838,1.17437617101144 +"79",3,4,1.08484841692792,1.13854617631975 +"80",4,4,0.25641842632975,1.09447871565124 +"81",5,4,0.706500061197945,1.11504830107795 +"82",6,4,1.62136816485343,1.1714904144788 +"83",7,4,0.888945621662571,1.13397244059695 +"84",8,4,0.893275873988922,1.12831772297988 +"85",9,4,1.54783166673203,1.17320094742758 +"86",10,4,1.44135114502091,1.16186502846703 +"87",11,4,0.0485221621646274,1.0870269613311 +"88",12,4,1.42473787469111,1.15662283821991 +"89",13,4,1.55905337880035,1.1723623269336 +"90",14,4,1.3888670431405,1.16748859706223 +"91",15,4,1.41759082159156,1.16051008904577 +"92",16,4,1.34946736707715,1.1523025530755 +"93",17,4,1.21135318348153,1.15564233894629 +"94",18,4,NA,NA +"95",19,4,1.3487788458358,1.16528419577486 +"96",20,4,1.57117162263174,1.17341680401659 +"97",21,4,0.814123719470646,1.13963129715709 +"98",22,4,1.23065500608209,1.15617973611553 +"99",23,4,1.30090997397219,1.15760082094408 +"100",24,4,1.3487788458358,1.16528419577486 +"101",25,4,1.57117162263174,1.17341680401659 +"102",26,4,0.814123719470646,1.13963129715709 +"103",27,4,1.23065500608209,1.15617973611553 +"104",28,4,1.30090997397219,1.15760082094408 +"105",29,4,0.915658114975741,1.14168371889418 +"106",30,4,1.71309772403373,1.16893403550195 +"107",31,4,0.975569884931409,1.14289387308405 +"108",32,4,1.24403410987816,1.16057896699347 +"109",33,4,1.57453950685255,1.17223047836964 +"110",34,4,1.27493742216464,1.15565678369316 +"111",35,4,1.04019552633126,1.15400107432615 +"112",36,4,1.43064824250375,1.17257198605234 +"113",37,4,1.11523082753833,1.15407095551529 +"114",38,4,0.951425060094164,1.14619279269113 +"115",1,6,0.644979287858341,1.12272246613109 +"116",2,6,0.968399423703174,1.12681859863188 +"117",3,6,0.737037111977024,1.11189286584331 +"118",4,6,0.401741560773636,1.09804434507795 +"119",5,6,0.954247251264368,1.12766963740727 +"120",6,6,NA,NA +"121",7,6,NA,NA +"122",8,6,NA,NA +"123",9,6,NA,NA +"124",10,6,NA,NA +"125",11,6,NA,NA +"126",12,6,NA,NA +"127",13,6,NA,NA +"128",14,6,NA,NA +"129",15,6,NA,NA +"130",16,6,NA,NA +"131",17,6,NA,NA +"132",18,6,NA,NA +"133",19,6,NA,NA +"134",20,6,NA,NA +"135",21,6,NA,NA +"136",22,6,NA,NA +"137",23,6,NA,NA +"138",24,6,NA,NA +"139",25,6,NA,NA +"140",26,6,NA,NA +"141",27,6,NA,NA +"142",28,6,NA,NA +"143",29,6,NA,NA +"144",30,6,NA,NA +"145",31,6,NA,NA +"146",32,6,NA,NA +"147",33,6,NA,NA +"148",34,6,NA,NA +"149",35,6,NA,NA +"150",36,6,NA,NA +"151",37,6,NA,NA +"152",38,6,NA,NA +"153",1,7,1.37873129869711,1.12705218586732 +"154",2,7,0.898687948870809,1.10882894038329 +"155",3,7,1.06959739078933,1.10986327265822 +"156",4,7,1.52081794416156,1.14514448653616 +"157",5,7,1.6350224780812,1.15271708520684 +"158",6,7,0.665048274009493,1.08785027876506 +"159",7,7,1.29001553172443,1.12207931581872 +"160",8,7,1.56524356897872,1.13610969459652 +"161",9,7,1.1902859674977,1.12635910945405 +"162",10,7,1.60278948941548,1.13458027502394 +"163",11,7,0.539931837210234,1.08935701270663 +"164",12,7,1.37157024890009,1.12925188022265 +"165",13,7,1.09507224951389,1.12091185583944 +"166",14,7,0.642514288115703,1.1038820820581 +"167",15,7,NA,NA +"168",16,7,NA,NA +"169",17,7,NA,NA +"170",18,7,NA,NA +"171",19,7,0.976604568314585,1.12242134001726 +"172",20,7,1.70304414962028,1.151763164912 +"173",21,7,1.64842892890317,1.14125149924178 +"174",22,7,1.44274849206991,1.14912788182653 +"175",23,7,1.07845370544509,1.13740442031499 +"176",24,7,0.976604568314585,1.12242134001726 +"177",25,7,1.70304414962028,1.151763164912 +"178",26,7,1.64842892890317,1.14125149924178 +"179",27,7,1.44274849206991,1.14912788182653 +"180",28,7,1.07845370415855,1.13740442031499 +"181",29,7,1.63543946348679,1.14128066675741 +"182",30,7,1.2113270853589,1.12377635751157 +"183",31,7,0.724799587580023,1.1003921884669 +"184",32,7,1.54873783172071,1.15486386082295 +"185",33,7,1.31646413984122,1.13388151191134 +"186",34,7,1.44757287901343,1.15783266943475 +"187",35,7,1.40680509616701,1.15213458658076 +"188",36,7,1.52912568533918,1.16043635694807 +"189",37,7,1.6036346815858,1.15978005082261 +"190",38,7,1.4595873017287,1.15275912578039 +"191",1,8,1.03087868532153,1.12547653975575 +"192",2,8,0.867116871113098,1.11694324303833 +"193",3,8,1.43125642056883,1.15180263234408 +"194",4,8,1.40400912749322,1.15565467448511 +"195",5,8,1.44400666923173,1.15420669302665 +"196",6,8,0.00685119290620195,1.03921525790658 +"197",7,8,1.34751611911024,1.12935159386213 +"198",8,8,1.49861021919785,1.13934536640169 +"199",9,8,0.85794912342851,1.09737430980804 +"200",10,8,1.01335661464971,1.12389857156893 +"201",11,8,0.920537134896552,1.11905348807514 +"202",12,8,0.934325016733272,1.10491821813862 +"203",13,8,0.827114618095486,1.11207083100117 +"204",14,8,1.04109220110083,1.14154423672522 +"205",15,8,1.22556879013501,1.13076971639997 +"206",16,8,1.18246725408383,1.12417887481778 +"207",17,8,1.24508945418845,1.13075978072112 +"208",18,8,1.24958586865869,1.12927087535886 +"209",19,8,0.710936252804421,1.10995638832436 +"210",20,8,1.63422492038919,1.15588675357455 +"211",21,8,1.60863021863414,1.14722034154951 +"212",22,8,1.50890487955027,1.15690795037529 +"213",23,8,1.57345956713651,1.15719191317632 +"214",24,8,0.710936252804421,1.10995638832436 +"215",25,8,1.63422492038919,1.15588675357455 +"216",26,8,1.60863021863414,1.14722034154951 +"217",27,8,1.50890487955027,1.15690795037529 +"218",28,8,1.5734595681752,1.15719191317632 +"219",29,8,1.40629522506523,1.13171691335082 +"220",30,8,1.12483134972995,1.11083515640263 +"221",31,8,1.10080235906752,1.10641883933858 +"222",32,8,0.876148779643861,1.10641233799649 +"223",33,8,0.500099366312325,1.0865018453682 +"224",34,8,0.784201492290561,1.11895222779759 +"225",35,8,NA,NA +"226",36,8,NA,NA +"227",37,8,NA,NA +"228",38,8,NA,NA +"229",1,9,0.865406874369059,1.08725683291809 +"230",2,9,0.716409950766205,1.08412367791145 +"231",3,9,1.01523020917361,1.0931137534029 +"232",4,9,1.12374890350849,1.16410067176398 +"233",5,9,1.16981715431419,1.11436155363183 +"234",6,9,1.65872267673633,1.13342907322432 +"235",7,9,0.638436989766969,1.07854457936439 +"236",8,9,0.837897771287698,1.08375713871679 +"237",9,9,0.82662680817179,1.09255299414121 +"238",10,9,1.09755210065193,1.1042062625983 +"239",11,9,NA,NA +"240",12,9,NA,NA +"241",13,9,NA,NA +"242",14,9,NA,NA +"243",15,9,NA,NA +"244",16,9,NA,NA +"245",17,9,NA,NA +"246",18,9,NA,NA +"247",19,9,NA,NA +"248",20,9,NA,NA +"249",21,9,NA,NA +"250",22,9,NA,NA +"251",23,9,NA,NA +"252",24,9,NA,NA +"253",25,9,NA,NA +"254",26,9,NA,NA +"255",27,9,NA,NA +"256",28,9,NA,NA +"257",29,9,NA,NA +"258",30,9,NA,NA +"259",31,9,NA,NA +"260",32,9,NA,NA +"261",33,9,NA,NA +"262",34,9,NA,NA +"263",35,9,NA,NA +"264",36,9,NA,NA +"265",37,9,NA,NA +"266",38,9,NA,NA +"267",1,10,1.51196869430009,1.14396587408368 +"268",2,10,0.543574914569513,1.08866788705189 +"269",3,10,1.87255415075042,1.14140115046756 +"270",4,10,1.66924567266955,1.15549282942796 +"271",5,10,1.76237464909148,1.15809699614113 +"272",6,10,1.83730394050458,1.15488808200594 +"273",7,10,1.49493265184815,1.13159373363664 +"274",8,10,1.42817754490299,1.14388128114991 +"275",9,10,1.40432085740673,1.14087763740839 +"276",10,10,1.58694578510965,1.15221906879659 +"277",11,10,0.807737637908788,1.11146105201734 +"278",12,10,1.42617030276444,1.12848816401912 +"279",13,10,1.25401696578993,1.12230598110434 +"280",14,10,1.51463275440496,1.150290483079 +"281",15,10,1.46942475627876,1.13771186335769 +"282",16,10,1.41830190945104,1.13893727753531 +"283",17,10,1.69105481347864,1.14731111815189 +"284",18,10,1.32020728740982,1.13094912869545 +"285",19,10,NA,NA +"286",20,10,0.857274565884085,1.1160018247635 +"287",21,10,1.13181600668772,1.12936176648569 +"288",22,10,NA,NA +"289",23,10,NA,NA +"290",24,10,NA,NA +"291",25,10,0.857274565884085,1.1160018247635 +"292",26,10,1.13181600668772,1.12936176648569 +"293",27,10,NA,NA +"294",28,10,NA,NA +"295",29,10,NA,NA +"296",30,10,NA,NA +"297",31,10,NA,NA +"298",32,10,NA,NA +"299",33,10,NA,NA +"300",34,10,NA,NA +"301",35,10,1.37244663737552,1.13678942692537 +"302",36,10,1.37100740966617,1.13637776874802 +"303",37,10,1.2468334789708,1.11718041754221 +"304",38,10,0.418782969041485,1.08003810720901 +"305",1,11,1.13294876801305,1.17129901809441 +"306",2,11,0.944408196046491,1.15331546192637 +"307",3,11,1.09549168404299,1.16627192240117 +"308",4,11,0.673933579993972,1.14151954218726 +"309",5,11,1.14010198118309,1.17344578086884 +"310",6,11,0.959157456852261,1.15720373984514 +"311",7,11,0.876974404372511,1.15015495442051 +"312",8,11,0.706959909745478,1.14984141044489 +"313",9,11,0.698906713285627,1.14603934384502 +"314",10,11,0.98719489998464,1.16022878891131 +"315",11,11,1.81851956135261,1.19589200268101 +"316",12,11,1.11811271850412,1.16542894728223 +"317",13,11,1.05579535659549,1.16886413762964 +"318",14,11,0.696021447542149,1.14926106823333 +"319",15,11,0.918670053141282,1.16961560248949 +"320",16,11,1.13515252162277,1.16781440854769 +"321",17,11,1.15673815495226,1.17497968195887 +"322",18,11,1.36335854139387,1.1721412601032 +"323",19,11,0.961161767108743,1.16626496925123 +"324",20,11,1.21094056881245,1.17688671455761 +"325",21,11,1.54736535944668,1.19659297602138 +"326",22,11,1.180003071522,1.18442956866007 +"327",23,11,1.8695886260789,1.21265403052901 +"328",24,11,0.961161767108743,1.16626496925123 +"329",25,11,1.21094056881245,1.17688671455761 +"330",26,11,1.54736535944668,1.19659297602138 +"331",27,11,1.180003071522,1.18442956866007 +"332",28,11,1.86958862830953,1.21265403052901 +"333",29,11,1.08474689954286,1.17533082605071 +"334",30,11,0.635377645804638,1.14610056368633 +"335",31,11,1.58357270254461,1.20477069345013 +"336",32,11,1.34657063885098,1.19253498225493 +"337",33,11,1.04987040885468,1.1790270364335 +"338",34,11,1.26058021083151,1.19011608258225 +"339",35,11,1.83574158500519,1.2132917858912 +"340",36,11,1.31164387928312,1.18902101759288 +"341",37,11,1.51162545957362,1.20317463051305 +"342",38,11,1.10911669671493,1.17397133193596 +"343",1,12,1.53171216044175,1.16011334901802 +"344",2,12,0.949414160414841,1.12489976671325 +"345",3,12,1.8289581366259,1.16347403680233 +"346",4,12,1.44914156365719,1.14911490236876 +"347",5,12,0.983257943635204,1.1160514849365 +"348",6,12,1.55345629020532,1.16191933951978 +"349",7,12,1.16128245883908,1.1255036676894 +"350",8,12,1.2881721852394,1.13985198139216 +"351",9,12,0.920810057986507,1.11995896056906 +"352",10,12,0.590684878687601,1.11362625121341 +"353",11,12,1.75748719266518,1.16752627257436 +"354",12,12,0.283942074592117,1.08268880662346 +"355",13,12,0.844286217480903,1.11558744784687 +"356",14,12,1.19712744989587,1.14414248074826 +"357",15,12,0.736002363536794,1.11849832067692 +"358",16,12,0.257189611867582,1.08601201201149 +"359",17,12,1.02851637665349,1.12613416554687 +"360",18,12,1.67030146916259,1.15971162127294 +"361",19,12,1.38931266989935,1.15730168283154 +"362",20,12,1.14620108525718,1.14248229175931 +"363",21,12,0.532528049495698,1.11520804817777 +"364",22,12,0.690869944770228,1.12666179086396 +"365",23,12,0.511482556359852,1.11274397833155 +"366",24,12,1.38931266989935,1.15730168283154 +"367",25,12,1.14620108525718,1.14248229175931 +"368",26,12,0.532528049495698,1.11520804817777 +"369",27,12,0.690869944770228,1.12666179086396 +"370",28,12,0.511482556883928,1.11274397833155 +"371",29,12,NA,NA +"372",30,12,NA,NA +"373",31,12,NA,NA +"374",32,12,NA,NA +"375",33,12,NA,NA +"376",34,12,NA,NA +"377",35,12,NA,NA +"378",36,12,NA,NA +"379",37,12,NA,NA +"380",38,12,NA,NA +"381",1,13,0.708648438928239,1.10431362220247 +"382",2,13,1.43402412540706,1.15539532188295 +"383",3,13,1.02680660861034,1.12034339685972 +"384",4,13,0.568371800020094,1.09803995020986 +"385",5,13,1.21378862432562,1.14329268021469 +"386",6,13,1.76255688773651,1.16211723622118 +"387",7,13,0.757986276152868,1.10307399737708 +"388",8,13,0.976036055525891,1.12046821002379 +"389",9,13,0.860071303271687,1.1152414932669 +"390",10,13,0.606684787193447,1.10732444756608 +"391",11,13,1.64603240074527,1.16070499665425 +"392",12,13,0.486538478648946,1.0792577475002 +"393",13,13,0.935157721505208,1.12517417906664 +"394",14,13,0.913914645045045,1.1150760512825 +"395",15,13,0.867447768813463,1.12510011043075 +"396",16,13,0.388388200176187,1.0922780775238 +"397",17,13,0.85434804366477,1.12947750645433 +"398",18,13,0.883431466215334,1.12672946397712 +"399",19,13,0.549216773824748,1.10151990971873 +"400",20,13,0.93903105637951,1.12711935856863 +"401",21,13,1.61155050319573,1.16554821665938 +"402",22,13,1.04462120970346,1.13253021537615 +"403",23,13,1.18527223549144,1.1428333053035 +"404",24,13,0.549216773824748,1.10151990971873 +"405",25,13,0.93903105637951,1.12711935856863 +"406",26,13,1.61155050319573,1.16554821665938 +"407",27,13,1.04462120970346,1.13253021537615 +"408",28,13,1.18527223643175,1.1428333053035 +"409",29,13,0.921784205530997,1.11946260863384 +"410",30,13,1.09432847532376,1.12679518213346 +"411",31,13,0.823726711761858,1.10868220435612 +"412",32,13,1.02984642193904,1.12783306708827 +"413",33,13,1.00309080795818,1.13164485585192 +"414",34,13,0.917005913932771,1.13819648303828 +"415",35,13,0.884317356830913,1.09945872630449 +"416",36,13,0.608377807956345,1.08279894598651 +"417",37,13,1.04897106018483,1.10559669558205 +"418",38,13,1.00759632688816,1.10460293662861 +"419",1,17,0.397371654751165,1.12340248039221 +"420",2,17,0.637042927554761,1.12088195725103 +"421",3,17,0.741845342616268,1.12148561593826 +"422",4,17,0.182575193226163,1.09909187670024 +"423",5,17,0.0107465562039248,1.10312555051209 +"424",6,17,1.72654303034134,1.19085932490778 +"425",7,17,NA,NA +"426",8,17,NA,NA +"427",9,17,NA,NA +"428",10,17,NA,NA +"429",11,17,NA,NA +"430",12,17,NA,NA +"431",13,17,NA,NA +"432",14,17,NA,NA +"433",15,17,NA,NA +"434",16,17,NA,NA +"435",17,17,NA,NA +"436",18,17,NA,NA +"437",19,17,NA,NA +"438",20,17,NA,NA +"439",21,17,NA,NA +"440",22,17,NA,NA +"441",23,17,NA,NA +"442",24,17,NA,NA +"443",25,17,NA,NA +"444",26,17,NA,NA +"445",27,17,NA,NA +"446",28,17,NA,NA +"447",29,17,NA,NA +"448",30,17,NA,NA +"449",31,17,NA,NA +"450",32,17,NA,NA +"451",33,17,NA,NA +"452",34,17,NA,NA +"453",35,17,NA,NA +"454",36,17,NA,NA +"455",37,17,NA,NA +"456",38,17,NA,NA +"457",1,14,NA,NA +"458",2,14,NA,NA +"459",3,14,NA,NA +"460",4,14,0.637725316770823,1.16001993777832 +"461",5,14,NA,NA +"462",6,14,0.041668074458189,1.12343248151745 +"463",7,14,0.32301525714092,1.11908480780242 +"464",8,14,0.481942423954093,1.06818410129158 +"465",9,14,0.551322692443045,1.12955247207574 +"466",10,14,0.513447946099497,1.14278710608292 +"467",11,14,NA,NA +"468",12,14,NA,NA +"469",13,14,NA,NA +"470",14,14,NA,NA +"471",15,14,1.52958569262027,1.20883839898651 +"472",16,14,1.19686282074369,1.17816624355871 +"473",17,14,1.00905959358665,1.1734657537103 +"474",18,14,1.16291857881457,1.18691767384929 +"475",19,14,NA,NA +"476",20,14,NA,NA +"477",21,14,NA,NA +"478",22,14,NA,NA +"479",23,14,NA,NA +"480",24,14,NA,NA +"481",25,14,NA,NA +"482",26,14,NA,NA +"483",27,14,NA,NA +"484",28,14,NA,NA +"485",29,14,0.535356223432884,1.13979966525761 +"486",30,14,0.673322326965164,1.15812392618241 +"487",31,14,0.433062950433067,1.12842156483203 +"488",32,14,0.448054872657919,1.14155025512973 +"489",33,14,NA,NA +"490",34,14,NA,NA +"491",35,14,0.537644265599931,1.1629118482843 +"492",36,14,0.258503250291034,1.14996037641939 +"493",37,14,0.198764715944129,1.13518242663789 +"494",38,14,0.696019083558675,1.15821029347618 +"495",1,15,NA,NA +"496",2,15,NA,NA +"497",3,15,NA,NA +"498",4,15,0.450854932727821,1.08530074929005 +"499",5,15,NA,NA +"500",6,15,NA,NA +"501",7,15,NA,NA +"502",8,15,NA,NA +"503",9,15,NA,NA +"504",10,15,NA,NA +"505",11,15,NA,NA +"506",12,15,NA,NA +"507",13,15,NA,NA +"508",14,15,NA,NA +"509",15,15,NA,NA +"510",16,15,NA,NA +"511",17,15,NA,NA +"512",18,15,NA,NA +"513",19,15,0.99398967750148,1.11109490867849 +"514",20,15,0.619047571660881,1.0904463140496 +"515",21,15,0.0993495814704281,1.05656726138817 +"516",22,15,1.11484252799097,1.12078409043054 +"517",23,15,0.538506458826979,1.08560558959419 +"518",24,15,0.99398967750148,1.11109490867849 +"519",25,15,0.619047571660881,1.0904463140496 +"520",26,15,0.0993495814704281,1.05656726138817 +"521",27,15,1.11484252799097,1.12078409043054 +"522",28,15,0.53850645867373,1.08560558959419 +"523",29,15,0.0701438117304582,1.06091105201057 +"524",30,15,0.744816210081317,1.12187119310493 +"525",31,15,0.601297092810903,1.13570233709735 +"526",32,15,0.176804525490159,1.06026340301534 +"527",33,15,0.76298320523768,1.08536077797658 +"528",34,15,0.843823595699865,1.08570343786072 +"529",35,15,0.819544992503458,1.0849664133486 +"530",36,15,0.485336658093302,1.07433819333857 +"531",37,15,0.798478724618778,1.0952849374714 +"532",38,15,1.01864699062983,1.0983296558784 +"533",1,16,NA,NA +"534",2,16,NA,NA +"535",3,16,NA,NA +"536",4,16,0.778470821599518,1.11510256983205 +"537",5,16,NA,NA +"538",6,16,NA,NA +"539",7,16,NA,NA +"540",8,16,NA,NA +"541",9,16,NA,NA +"542",10,16,NA,NA +"543",11,16,0.899410557619577,1.11262660758336 +"544",12,16,0.353830612018332,1.08855198111311 +"545",13,16,0.77071676240625,1.11783327866945 +"546",14,16,0.840980241195041,1.11681585825188 +"547",15,16,0.278609643774482,1.05762748775049 +"548",16,16,0.904396896860163,1.08284695892264 +"549",17,16,1.07102104519819,1.10186480648666 +"550",18,16,1.15420686258293,1.11402457695741 +"551",19,16,1.31459713088218,1.12143758380509 +"552",20,16,0.971735931601977,1.14775353141235 +"553",21,16,0.137209201006426,1.05912596116092 +"554",22,16,1.94289209066575,1.14293381622051 +"555",23,16,1.0676129795062,1.12135450688116 +"556",24,16,1.31459713088218,1.12143758380509 +"557",25,16,0.971735931601977,1.14775353141235 +"558",26,16,0.137209201006426,1.05912596116092 +"559",27,16,1.94289209066575,1.14293381622051 +"560",28,16,1.06761297939646,1.12135450688116 +"561",29,16,1.00524578772399,1.10771055029795 +"562",30,16,0.436410961628351,1.06991237172764 +"563",31,16,0.840285050122837,1.08759864284292 +"564",32,16,1.07269923366635,1.12702876009147 +"565",33,16,0.405875906933875,1.06742182257258 +"566",34,16,NA,NA +"567",35,16,1.55599527045989,1.12602052227352 +"568",36,16,0.943301513135031,1.10777115899417 +"569",37,16,0.826341707538332,1.08935501566653 +"570",38,16,0.906960839275118,1.08765917526628 +"571",1,18,NA,NA +"572",2,18,NA,NA +"573",3,18,NA,NA +"574",4,18,0.783539928214609,1.11813589716027 +"575",5,18,NA,NA +"576",6,18,NA,NA +"577",7,18,NA,NA +"578",8,18,NA,NA +"579",9,18,NA,NA +"580",10,18,NA,NA +"581",11,18,NA,NA +"582",12,18,NA,NA +"583",13,18,NA,NA +"584",14,18,NA,NA +"585",15,18,NA,NA +"586",16,18,NA,NA +"587",17,18,NA,NA +"588",18,18,NA,NA +"589",19,18,NA,NA +"590",20,18,NA,NA +"591",21,18,NA,NA +"592",22,18,NA,NA +"593",23,18,NA,NA +"594",24,18,NA,NA +"595",25,18,NA,NA +"596",26,18,NA,NA +"597",27,18,NA,NA +"598",28,18,NA,NA +"599",29,18,NA,NA +"600",30,18,NA,NA +"601",31,18,NA,NA +"602",32,18,NA,NA +"603",33,18,NA,NA +"604",34,18,NA,NA +"605",35,18,NA,NA +"606",36,18,NA,NA +"607",37,18,NA,NA +"608",38,18,NA,NA +"609",1,19,NA,NA +"610",2,19,NA,NA +"611",3,19,NA,NA +"612",4,19,0.358160584372551,1.12141278284512 +"613",5,19,NA,NA +"614",6,19,NA,NA +"615",7,19,NA,NA +"616",8,19,NA,NA +"617",9,19,NA,NA +"618",10,19,NA,NA +"619",11,19,NA,NA +"620",12,19,NA,NA +"621",13,19,NA,NA +"622",14,19,NA,NA +"623",15,19,NA,NA +"624",16,19,NA,NA +"625",17,19,NA,NA +"626",18,19,NA,NA +"627",19,19,NA,NA +"628",20,19,NA,NA +"629",21,19,NA,NA +"630",22,19,NA,NA +"631",23,19,NA,NA +"632",24,19,NA,NA +"633",25,19,NA,NA +"634",26,19,NA,NA +"635",27,19,NA,NA +"636",28,19,NA,NA +"637",29,19,NA,NA +"638",30,19,NA,NA +"639",31,19,NA,NA +"640",32,19,NA,NA +"641",33,19,NA,NA +"642",34,19,NA,NA +"643",35,19,NA,NA +"644",36,19,NA,NA +"645",37,19,NA,NA +"646",38,19,NA,NA +"647",1,20,NA,NA +"648",2,20,NA,NA +"649",3,20,NA,NA +"650",4,20,0.662586070999699,1.13687987363842 +"651",5,20,NA,NA +"652",6,20,NA,NA +"653",7,20,NA,NA +"654",8,20,NA,NA +"655",9,20,NA,NA +"656",10,20,NA,NA +"657",11,20,NA,NA +"658",12,20,NA,NA +"659",13,20,NA,NA +"660",14,20,NA,NA +"661",15,20,NA,NA +"662",16,20,NA,NA +"663",17,20,NA,NA +"664",18,20,NA,NA +"665",19,20,NA,NA +"666",20,20,NA,NA +"667",21,20,NA,NA +"668",22,20,NA,NA +"669",23,20,NA,NA +"670",24,20,NA,NA +"671",25,20,NA,NA +"672",26,20,NA,NA +"673",27,20,NA,NA +"674",28,20,NA,NA +"675",29,20,NA,NA +"676",30,20,NA,NA +"677",31,20,NA,NA +"678",32,20,NA,NA +"679",33,20,NA,NA +"680",34,20,NA,NA +"681",35,20,NA,NA +"682",36,20,NA,NA +"683",37,20,NA,NA +"684",38,20,NA,NA +"685",1,21,NA,NA +"686",2,21,NA,NA +"687",3,21,NA,NA +"688",4,21,0.695359577017985,1.12993667790767 +"689",5,21,NA,NA +"690",6,21,NA,NA +"691",7,21,0.107345979350902,1.05970739553995 +"692",8,21,NA,NA +"693",9,21,NA,NA +"694",10,21,NA,NA +"695",11,21,NA,NA +"696",12,21,NA,NA +"697",13,21,NA,NA +"698",14,21,NA,NA +"699",15,21,NA,NA +"700",16,21,NA,NA +"701",17,21,NA,NA +"702",18,21,NA,NA +"703",19,21,NA,NA +"704",20,21,NA,NA +"705",21,21,NA,NA +"706",22,21,NA,NA +"707",23,21,NA,NA +"708",24,21,NA,NA +"709",25,21,NA,NA +"710",26,21,NA,NA +"711",27,21,NA,NA +"712",28,21,NA,NA +"713",29,21,NA,NA +"714",30,21,NA,NA +"715",31,21,NA,NA +"716",32,21,NA,NA +"717",33,21,NA,NA +"718",34,21,NA,NA +"719",35,21,NA,NA +"720",36,21,NA,NA +"721",37,21,NA,NA +"722",38,21,NA,NA +"723",1,1,NA,NA +"724",2,1,NA,NA +"725",3,1,NA,NA +"726",4,1,NA,NA +"727",5,1,NA,NA +"728",6,1,NA,NA +"729",7,1,NA,NA +"730",8,1,NA,NA +"731",9,1,NA,NA +"732",10,1,NA,NA +"733",11,1,1.82654329784205,1.18909813067039 +"734",12,1,1.33475511607699,1.14408009758451 +"735",13,1,0.87112786843476,1.0918667675825 +"736",14,1,0.894327850447934,1.08744664320334 +"737",15,1,0.859701518083286,1.10986479311138 +"738",16,1,0.815307794514095,1.10929017080738 +"739",17,1,1.70128349473623,1.15550657964041 +"740",18,1,1.22814933206453,1.14971766211407 +"741",19,1,1.62416692440103,1.15330859420087 +"742",20,1,1.35366271237194,1.1582658792173 +"743",21,1,1.86935002928657,1.14339094335889 +"744",22,1,1.67201899057738,1.12715125913269 +"745",23,1,1.44413552712137,1.13934003814188 +"746",24,1,1.62416692440103,1.15330859420087 +"747",25,1,1.35366271237194,1.1582658792173 +"748",26,1,1.86935002928657,1.14339094335889 +"749",27,1,1.67201899057738,1.12715125913269 +"750",28,1,1.44413552712137,1.13934003814188 +"751",29,1,1.60702913827278,1.15528464068845 +"752",30,1,1.20472382739082,1.18478476890178 +"753",31,1,1.47369286131086,1.14804743882864 +"754",32,1,1.49324705526523,1.16619068171106 +"755",33,1,1.74601558555717,1.16191510716621 +"756",34,1,1.57192023395775,1.1614980420393 +"757",35,1,1.69829886516943,1.14508426575111 +"758",36,1,1.7523749663471,1.16865873490806 +"759",37,1,1.707615820689,1.1567963299895 +"760",38,1,1.51487121870658,1.15496517694456 +"761",1,5,NA,NA +"762",2,5,NA,NA +"763",3,5,NA,NA +"764",4,5,NA,NA +"765",5,5,NA,NA +"766",6,5,NA,NA +"767",7,5,NA,NA +"768",8,5,NA,NA +"769",9,5,NA,NA +"770",10,5,NA,NA +"771",11,5,0.731797952883204,1.13056338856598 +"772",12,5,0.525160568819432,1.09244756834112 +"773",13,5,0.81883312034375,1.12133135710468 +"774",14,5,0.646568239935537,1.08548505725597 +"775",15,5,0.816934851007796,1.10884748425886 +"776",16,5,0.314541598896513,1.12147208302061 +"777",17,5,0.933846023059118,1.11673639767059 +"778",18,5,1.1718319446547,1.12671658812234 +"779",19,5,1.58979936626209,1.16571151239542 +"780",20,5,0.786114369643421,1.12582817096713 +"781",21,5,1.50138782081908,1.16253759891381 +"782",22,5,0.636473571498429,1.11912341898578 +"783",23,5,1.15377119598524,1.14666214832631 +"784",24,5,1.58979936626209,1.16571151239542 +"785",25,5,0.786114369643421,1.12582817096713 +"786",26,5,1.50138782081908,1.16253759891381 +"787",27,5,0.636473571498429,1.11912341898578 +"788",28,5,1.15377119598524,1.14666214832631 +"789",29,5,0.724842465743855,1.11247032209313 +"790",30,5,0.787385191240715,1.11433025109476 +"791",31,5,1.18474297036851,1.1324854667384 +"792",32,5,1.24669005285473,1.14108710122849 +"793",33,5,1.29948496295285,1.13819139738012 +"794",34,5,1.04445366335103,1.12324498339965 +"795",35,5,0.680632460134855,1.10390154544635 +"796",36,5,1.16681561352878,1.10778414826625 +"797",37,5,0.555611427242176,1.09144611864342 +"798",38,5,0.6347739327494,1.09214223486489 diff --git a/data_preparation/dataPrep.R b/data_preparation/dataPrep.R index a27a239..32c8064 100644 --- a/data_preparation/dataPrep.R +++ b/data_preparation/dataPrep.R @@ -4,6 +4,9 @@ library(tidyverse) +library(DBI) +library(RSQLite) + gpsData <- read.csv("data/gps.csv") @@ -12,13 +15,16 @@ gpsDataTibble <- as_tibble(gpsData) -workingTibble <- head(gpsDataTibble, 100000) +#workingTibble <- head(gpsDataTibble, 500000) +workingTibble <- gpsDataTibble -playerIds <-unique(workingTibble$PlayerID) +playerIds <-unique(workingTibble$PlayerID) +cat("Number of Players: ", length(playerIds), sep="") gameIds <- unique(workingTibble$GameID) +cat("Number of Games: ", length(gameIds), sep="") playerIDMetrics <- c() @@ -37,16 +43,11 @@ for(playerID in playerIds) # crunch average speed - averageSpeed <- c(averageSpeed, mean(speedTibble$Speed)) + averageSpeed <- c(averageSpeed, mean(speedTibble$Speed, na.rm = 0)) # average for accel value - accelDistance <- c(accelDistance, mean(sqrt(speedTibble$AccelX^2 + speedTibble$AccelY^2 + speedTibble$AccelZ^ 2))) - - - #xAccel <- c(xAccel, mean(speedTibble$AccelX)) - #yAccel <- c(yAccel, mean(speedTibble$AccelY)) - #zAccel <- c(zAccel, mean(speedTibble$AccelZ)) + accelDistance <- c(accelDistance, mean(sqrt(speedTibble$AccelX^2 + speedTibble$AccelY^2 + speedTibble$AccelZ^ 2), na.rm = 0)) # game and player id to vector @@ -58,6 +59,23 @@ for(playerID in playerIds) plot(accelDistance, averageSpeed) +compressedMetrics <- tibble(gameID = gameIDMetrics, playerID = playerIDMetrics, averageSpeed = averageSpeed, accelerationVector = accelDistance) + + +length(compressedMetrics$averageSpeed) +length(compressedMetrics$accelerationVector) + +write.csv(compressedMetrics, "data/speedData.csv") + +#putSQLiteHere <- "gpsData.sqlite" # could also be ":memory:" +#mySQLiteDB <- dbConnect(RSQLite::SQLite(),putSQLiteHere) + + +#dbWriteTable(mySQLiteDB, "gpsData", compressedMetrics, overwrite=TRUE) + +#dbDisconnect(mySQLiteDB) + +