Ryan Missel 5 years ago
parent
commit
0f29841b03
6 changed files with 410 additions and 7 deletions
  1. +336
    -0
      data_preparation/cleaned/slidingWorkAverage.csv
  2. +50
    -0
      data_preparation/createWorkSequenceData.R
  3. +1
    -1
      data_preparation/dataPrep.R
  4. +2
    -2
      data_preparation/normalizeData.R
  5. +7
    -1
      data_preparation/readData.R
  6. +14
    -3
      data_preparation/replaceNanWithMedian.R

+ 336
- 0
data_preparation/cleaned/slidingWorkAverage.csv View File

@ -0,0 +1,336 @@
"","TimeSinceAugFirst","slidingWorkAverage"
"1",20,5563.95
"2",21,5895.66666666667
"3",22,6307.42857142857
"4",23,6331.71428571429
"5",24,6458.52380952381
"6",25,6752.33333333333
"7",26,6767.33333333333
"8",27,6766.61904761905
"9",28,6738.42857142857
"10",29,6798.66666666667
"11",30,6811.38095238095
"12",31,6813.7619047619
"13",32,6881.85714285714
"14",33,6840.42857142857
"15",34,6834.71428571429
"16",35,6788.47619047619
"17",36,6711.09523809524
"18",37,6720.61904761905
"19",38,6781.33333333333
"20",39,6495.04761904762
"21",40,6617.90476190476
"22",41,6578.85714285714
"23",42,6122.66666666667
"24",43,5613.04761904762
"25",44,5671
"26",45,5383.2380952381
"27",46,4878.52380952381
"28",47,4872.90476190476
"29",48,4874.33333333333
"30",49,4910.85714285714
"31",50,4796.80952380952
"32",51,4867.42857142857
"33",52,5067.90476190476
"34",53,5234.04761904762
"35",54,5216.19047619048
"36",55,5235.47619047619
"37",56,5313.09523809524
"38",57,5416.90476190476
"39",58,5454.90476190476
"40",59,5578.47619047619
"41",60,5850.80952380952
"42",61,5744.38095238095
"43",62,5768.66666666667
"44",63,6210.71428571429
"45",64,6592.95238095238
"46",65,6613.90476190476
"47",66,6986.7619047619
"48",67,7557.09523809524
"49",68,7567.71428571429
"50",69,7583.42857142857
"51",70,7640.33333333333
"52",71,7712.38095238095
"53",72,7741.19047619048
"54",73,7612.85714285714
"55",74,7466
"56",75,7487.42857142857
"57",76,7480.28571428571
"58",77,7064.61904761905
"59",78,6618.42857142857
"60",79,6647.38095238095
"61",80,6575.95238095238
"62",81,5935.85714285714
"63",82,6326.33333333333
"64",83,7005.38095238095
"65",84,6509.52380952381
"66",85,6314.66666666667
"67",86,6331
"68",87,5901.95238095238
"69",88,5370.85714285714
"70",89,5633.80952380952
"71",90,5935.52380952381
"72",91,5317.66666666667
"73",92,4865.38095238095
"74",93,4682.7619047619
"75",94,4640.61904761905
"76",95,4585.61904761905
"77",96,4604.66666666667
"78",97,4592.52380952381
"79",98,5018.95238095238
"80",99,5509.19047619048
"81",100,5545.38095238095
"82",101,5570.52380952381
"83",102,6642.42857142857
"84",103,6281.95238095238
"85",104,5579.19047619048
"86",105,6177.7619047619
"87",106,6478.2380952381
"88",107,6441.33333333333
"89",108,7018.95238095238
"90",109,7771.09523809524
"91",110,7487.42857142857
"92",111,7168.57142857143
"93",112,7570.95238095238
"94",113,7856.38095238095
"95",114,7973.7619047619
"96",115,7617.33333333333
"97",116,7176.85714285714
"98",117,7260.66666666667
"99",118,7479.2380952381
"100",119,7162.33333333333
"101",120,6722.57142857143
"102",121,6734.71428571429
"103",122,6630
"104",123,6050.57142857143
"105",124,6004.14285714286
"106",125,6003.57142857143
"107",126,5477.38095238095
"108",127,4982.38095238095
"109",128,4995.71428571429
"110",129,4822.14285714286
"111",130,4590
"112",131,4634.28571428571
"113",132,4634.28571428571
"114",133,4787.61904761905
"115",134,4950.19047619048
"116",135,5018.52380952381
"117",136,5628.90476190476
"118",137,6380.04761904762
"119",138,6255.7619047619
"120",139,6037.19047619048
"121",140,6435.90476190476
"122",141,6408.04761904762
"123",142,6788.90476190476
"124",143,6869.19047619048
"125",144,6356.95238095238
"126",145,6463.14285714286
"127",146,6653.61904761905
"128",147,6511.71428571429
"129",148,6512.95238095238
"130",149,6397.71428571429
"131",150,6617.2380952381
"132",151,6094.85714285714
"133",152,6766.28571428571
"134",153,6873.19047619048
"135",154,6273.19047619048
"136",155,6500.61904761905
"137",156,6401.80952380952
"138",157,6452.2380952381
"139",158,6449.42857142857
"140",159,6518
"141",160,6518
"142",161,6399.7619047619
"143",162,6653.19047619048
"144",163,6260.19047619048
"145",164,6179.2380952381
"146",165,6804.2380952381
"147",166,6751.14285714286
"148",167,6560.66666666667
"149",168,6990.90476190476
"150",169,6975.14285714286
"151",170,6970.14285714286
"152",171,6734.80952380952
"153",172,6583.04761904762
"154",173,6174.2380952381
"155",174,6067.33333333333
"156",175,6419.2380952381
"157",176,6005.47619047619
"158",177,5965.57142857143
"159",178,5539.04761904762
"160",179,5201.80952380952
"161",180,5306
"162",181,5357.33333333333
"163",182,4840.19047619048
"164",183,4516.04761904762
"165",184,4437.38095238095
"166",185,4148.19047619048
"167",186,3595.90476190476
"168",187,3589
"169",188,3614.71428571429
"170",189,3615.90476190476
"171",190,4194.09523809524
"172",191,4347.19047619048
"173",192,4576.33333333333
"174",193,5244.28571428571
"175",194,4937.38095238095
"176",195,4937.38095238095
"177",196,5191.42857142857
"178",197,5533.57142857143
"179",198,5683.71428571429
"180",199,5955.38095238095
"181",200,6318.57142857143
"182",201,6214.85714285714
"183",202,6167.80952380952
"184",203,6524.47619047619
"185",204,6826.14285714286
"186",205,6846.95238095238
"187",206,6975.66666666667
"188",207,7325.80952380952
"189",208,7488.04761904762
"190",209,7584.71428571429
"191",210,7458.04761904762
"192",211,6931.52380952381
"193",212,6847.33333333333
"194",213,6665.90476190476
"195",214,6637.09523809524
"196",215,6637.09523809524
"197",216,6637.09523809524
"198",217,6707.80952380952
"199",218,6657.04761904762
"200",219,6630.80952380952
"201",220,6465.09523809524
"202",221,5746.7619047619
"203",222,5677.71428571429
"204",223,5673.42857142857
"205",224,6052.2380952381
"206",225,6061.28571428571
"207",226,6100.90476190476
"208",227,6407.80952380952
"209",228,6582.80952380952
"210",229,6400.09523809524
"211",230,6277.71428571429
"212",231,5974.61904761905
"213",232,6039.85714285714
"214",233,6138.61904761905
"215",234,5793.95238095238
"216",235,5185.61904761905
"217",236,5185.61904761905
"218",237,5185.61904761905
"219",238,5011.33333333333
"220",239,4762.33333333333
"221",240,4749.28571428571
"222",241,4999.7619047619
"223",242,5391.90476190476
"224",243,5391.90476190476
"225",244,5391.90476190476
"226",245,5236.42857142857
"227",246,5204.09523809524
"228",247,5067.57142857143
"229",248,4865.90476190476
"230",249,4221.85714285714
"231",250,4196.14285714286
"232",251,4287.33333333333
"233",252,4549.61904761905
"234",253,4529.61904761905
"235",254,4321.95238095238
"236",255,4376.2380952381
"237",256,4534.95238095238
"238",257,4642.28571428571
"239",258,4867.95238095238
"240",259,4410.66666666667
"241",260,4181.7619047619
"242",261,4132
"243",262,3547.95238095238
"244",263,3165.57142857143
"245",264,3537.19047619048
"246",265,3752.71428571429
"247",266,3212
"248",267,3017.04761904762
"249",268,3013.47619047619
"250",269,2987.04761904762
"251",270,3462.28571428571
"252",271,3469.42857142857
"253",272,3391.09523809524
"254",273,3847.14285714286
"255",274,4045.71428571429
"256",275,4249.85714285714
"257",276,4280.47619047619
"258",277,4291.42857142857
"259",278,4184.09523809524
"260",279,3958.42857142857
"261",280,4075.47619047619
"262",281,4352.66666666667
"263",282,4394.80952380952
"264",283,4441.95238095238
"265",284,4476.2380952381
"266",285,4435.66666666667
"267",286,4468.14285714286
"268",287,4414.09523809524
"269",288,4349
"270",289,4450.19047619048
"271",290,4178.04761904762
"272",291,3862.09523809524
"273",292,3881.38095238095
"274",293,3871.38095238095
"275",294,3611.19047619048
"276",295,3662.61904761905
"277",296,3575.85714285714
"278",297,3918.2380952381
"279",298,4170.2380952381
"280",299,4170.2380952381
"281",300,4170.2380952381
"282",301,4577.85714285714
"283",302,4423.38095238095
"284",303,4388.38095238095
"285",304,4756.47619047619
"286",305,4869.19047619048
"287",306,4538.14285714286
"288",307,4290.14285714286
"289",308,4433.2380952381
"290",309,4762.28571428571
"291",310,4642.71428571429
"292",311,4739.61904761905
"293",312,4890.19047619048
"294",313,4977.90476190476
"295",314,5076.2380952381
"296",315,4817.2380952381
"297",316,4391.52380952381
"298",317,4344.14285714286
"299",318,4162.71428571429
"300",319,4213.19047619048
"301",320,4247.85714285714
"302",321,4270.42857142857
"303",322,4225.42857142857
"304",323,4455.19047619048
"305",324,4327.80952380952
"306",325,4272.80952380952
"307",326,4688.19047619048
"308",327,4688.19047619048
"309",328,4688.19047619048
"310",329,5210.80952380952
"311",330,5324.14285714286
"312",331,5318.71428571429
"313",332,5487.85714285714
"314",333,5625.85714285714
"315",334,5602.42857142857
"316",335,5535.52380952381
"317",336,5745.47619047619
"318",337,6030.2380952381
"319",338,5963.57142857143
"320",339,5825
"321",340,5540.95238095238
"322",341,5506.28571428571
"323",342,5496.09523809524
"324",343,5394.66666666667
"325",344,5061.95238095238
"326",345,5061.2380952381
"327",346,4868.61904761905
"328",347,4190.04761904762
"329",348,4192.90476190476
"330",349,4192.90476190476
"331",350,3631.2380952381
"332",351,3369.09523809524
"333",352,3366.2380952381
"334",353,3131.38095238095
"335",354,2723.52380952381

+ 50
- 0
data_preparation/createWorkSequenceData.R View File

@ -0,0 +1,50 @@
source("readData.R")
library(tidyverse)
RPEData <-readNArpeData()
numDays <- max(RPEData$TimeSinceAugFirst)
dayList <- 0:numDays
workLoad <- c()
averageWorkLoad <- c()
for(day in dayList)
{
total <- 0
daylyActivities <- subset(RPEData, TimeSinceAugFirst == day)
cat("day: ", day, "\n",sep="")
cat("Activity count:", length(daylyActivities$DailyLoad), "\n", sep="")
averageWorkLoad <- c(averageWorkLoad, mean(daylyActivities$SessionLoad, na.rm = T))
workLoad <- c(workLoad, sum(daylyActivities$SessionLoad, na.rm = T))
}
plot(dayList, averageWorkLoad, main="Average Work Load")
plot(dayList, workLoad, main="Daily Total Work Load")
slidingAverage <- c()
window <- 21 - 1
for(day in window:numDays)
{
print(length(workLoad[c((day-window):day)]))
windowAverage <- mean(workLoad[c((day-window):day)])
slidingAverage <- c(slidingAverage, windowAverage)
}
plot(window:numDays, slidingAverage, main="Sliding Average")
plot(density(slidingAverage), main="Sliding Average Density")
plot(density(workLoad), main="Total Work Load Average")
dataTibble <- tibble(TimeSinceAugFirst = window:numDays, slidingWorkAverage = slidingAverage)
write.csv(dataTibble, "cleaned/slidingWorkAverage.csv")

+ 1
- 1
data_preparation/dataPrep.R View File

@ -7,7 +7,7 @@ library(tidyverse)
library(DBI)
library(RSQLite)
gpsData <- read.csv("data/gps.csv")
gpsData <- read.csv("data/gps.csv")c
gpsDataTibble <- as_tibble(gpsData)

+ 2
- 2
data_preparation/normalizeData.R View File

@ -83,11 +83,11 @@ for(id in playerIds)
}
normalWellnessData <- tibble(date = normDate, playerID = normPlayerIDs, normSoreness = normSoreness,
normalWellnessData <- tibble(TimeSinceAugFirst = normDate, playerID = normPlayerIDs, normSoreness = normSoreness,
normFatigue = normFatigue, normDesire = normDesire, normIrritability = normIrritability,
normSleepHours = normSleepHours, normSleepQuality = normSleepQuality)
write.csv(normalWellnessData, "cleaned/normalizedWellness.csv")
write.csv(normalWellnessData, "cleaned/time_series_normalized_wellness.csv")
plot()

+ 7
- 1
data_preparation/readData.R View File

@ -13,5 +13,11 @@ readWellnessData <- function()
readRPEData <- function()
{
as_tibble(read.csv("./cleaned/notnormalized_with_0Nan_rpe.csv"))
as_tibble(read.csv("./cleaned/time_series_notnormalized_with_continuousNan_rpe.csv"))
}
readNArpeData <- function()
{
as_tibble(read.csv("./cleaned/time_series_notnormalized_with_continuousNan_rpe.csv"))
}

+ 14
- 3
data_preparation/replaceNanWithMedian.R View File

@ -12,6 +12,10 @@ trainingData <- readRPEData()
trainingData$Duration[is.na(trainingData$Duration)] <- median(trainingData$Duration, na.rm=TRUE)
print(trainingData$Duration)
#RPE
trainingData$RPE[is.na(trainingData$RPE)] <- median(trainingData$RPE, na.rm=TRUE)
@ -32,14 +36,21 @@ trainingData$ObjectiveRating[is.na(trainingData$ObjectiveRating)] <- median(trai
trainingData$FocusRating[is.na(trainingData$FocusRating)] <- median(trainingData$FocusRating, na.rm=TRUE)
trainingData$RPE[is.na(trainingData$RPE)] <- median(trainingData$RPE, na.rm=TRUE)
write.csv(as.data.frame(trainingData), "cleaned/time_series_rpw_naReplacedWithMedian.csv")
# session load
trainingData$SessionLoad[is.na(trainingData$SessionLoad)] <- median(trainingData$SessionLoad, na.rm=TRUE)
# daily load
trainingData$DailyLoad[is.na(trainingData$DailyLoad)] <- median(trainingData$DailyLoad, na.rm=TRUE)
head(as.data.frame(trainingData), 100)
trainingData$RPE[is.na(trainingData$RPE)] <- median(trainingData$RPE, na.rm=TRUE)
write.csv(as.data.frame(trainingData), "cleaned/time_series_rpe_NA_ReplacedWithMedian.csv")
head(as.data.frame(trainingData), 100)
trainingData

Loading…
Cancel
Save