The goal of TidySpectrum is to provide an easy tool for tidying SecondSpectrum Physical Splits csv files. The package works with single files(function: tidy_data) and a list of files (function: list_tidy_data)

Installation

You can install the development version of TidySpectrum from Github with:

# install.packages("devtools")
devtools::install_github("LasseIshoi/TidySpectrum")

Example

This is a basic example of how to use the TidySpectrum package.

Below is an example of a Physical Splits csv file from SecondSpectrum

Second Spectrum Split Data …2 …3 …4 …5 …6 …7 …8 …9 …10 …11 …12 …13 …14 …15 …16 …17 …18 …19 …20 …21 …22
TeamA - TeamB : 2022-2-21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
02f1d5a7-7ac5-4419-b4ba-85da99a08241 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Threshold key (km/h) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Walking : 7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Jogging : 15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
LowSpeedRunning : 20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
HighSpeedRunning : 25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
LowSpeedSprinting : >25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Minute Splits 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 NA 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00
Team A (62da2c6c-67c5-4478-bcda-34aa58075367) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Total Distance 5055.29 6226.41 4779.51 6256.74 6158.10 6707.47 4424.53 6307.07 6533.86 5019.99 NA 6221.51 4411.40 6702.67 6702.17 3918.89 6728.53 4948.54 6567.48 5974.13 5178.85
Walking Distance 1810.76 1799.77 1716.37 1763.50 2013.92 1839.54 1450.40 1807.72 1706.15 1742.10 NA 1812.52 1490.97 1605.79 2010.53 1472.90 1852.09 1841.09 1791.84 2010.96 1530.23
Jogging Distance 2251.22 2555.79 1765.35 3319.02 2872.70 3550.96 1857.71 3200.36 2922.58 2479.05 NA 3102.82 1797.89 3567.68 3217.58 1440.42 3332.68 2048.26 3040.14 2813.82 2557.16
Low Speed Running Distance 639.64 1158.39 829.90 911.66 886.54 971.75 750.81 917.89 1209.04 664.32 NA 929.80 595.84 1149.67 995.77 683.30 1029.11 824.01 1082.39 699.21 692.46
High Speed Running Distance 255.56 540.33 347.24 228.39 279.01 317.04 317.76 307.93 582.44 123.59 NA 292.96 411.97 357.26 414.37 240.99 388.81 192.32 542.70 297.36 336.63
Sprinting Distance 98.11 172.13 120.65 34.16 105.93 28.18 47.84 73.17 113.65 10.92 NA 83.41 114.74 22.27 63.92 81.28 125.84 42.86 110.42 152.79 62.36
Walking Count 166.00 183.00 138.00 247.00 223.00 252.00 140.00 234.00 188.00 187.00 NA 251.00 134.00 221.00 241.00 116.00 241.00 151.00 231.00 203.00 188.00
Jogging Count 214.00 258.00 184.00 286.00 294.00 319.00 192.00 315.00 265.00 243.00 NA 332.00 181.00 304.00 323.00 164.00 316.00 209.00 302.00 266.00 247.00
Low Speed Running Count 79.00 128.00 82.00 99.00 103.00 111.00 79.00 113.00 132.00 73.00 NA 117.00 79.00 123.00 118.00 74.00 114.00 86.00 117.00 90.00 95.00
High Speed Running Count 28.00 45.00 30.00 20.00 28.00 30.00 22.00 28.00 50.00 11.00 NA 28.00 31.00 35.00 31.00 22.00 35.00 20.00 40.00 27.00 31.00
Sprinting Count 6.00 6.00 8.00 3.00 7.00 2.00 3.00 6.00 10.00 1.00 NA 5.00 9.00 3.00 6.00 5.00 6.00 4.00 8.00 8.00 5.00
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Athlete 1 (9ca4a299-6133-4cb3-aded-8ee19cfe8ced) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Total Distance 433.76 538.12 380.62 527.54 539.11 640.61 327.68 582.58 540.16 431.45 NA 570.49 359.90 396.15 607.79 82.39 0.00 0.00 0.00 0.00 0.00
Walking Distance 165.73 154.93 149.48 142.57 216.99 169.90 140.99 177.97 149.98 186.81 NA 165.85 150.04 123.44 176.54 19.55 0.00 0.00 0.00 0.00 0.00
Jogging Distance 199.77 233.12 110.25 321.39 235.03 362.28 150.64 327.54 229.87 234.11 NA 312.86 128.82 174.69 309.65 52.89 0.00 0.00 0.00 0.00 0.00
Low Speed Running Distance 49.12 92.30 60.03 58.95 62.20 73.11 24.11 75.04 119.60 10.53 NA 73.10 38.52 51.02 70.41 9.95 0.00 0.00 0.00 0.00 0.00
High Speed Running Distance 14.04 57.77 38.76 4.63 18.41 25.59 11.93 2.02 40.70 0.00 NA 15.59 42.52 39.98 50.36 0.00 0.00 0.00 0.00 0.00 0.00
Sprinting Distance 5.09 0.00 22.11 0.00 6.48 9.74 0.00 0.00 0.00 0.00 NA 3.08 0.00 7.02 0.83 0.00 0.00 0.00 0.00 0.00 0.00
Walking Count 17.00 15.00 13.00 29.00 19.00 26.00 11.00 29.00 16.00 18.00 NA 26.00 10.00 12.00 25.00 3.00 0.00 0.00 0.00 0.00 0.00
Jogging Count 18.00 21.00 15.00 33.00 25.00 34.00 15.00 35.00 24.00 22.00 NA 32.00 12.00 16.00 34.00 2.00 0.00 0.00 0.00 0.00 0.00
Low Speed Running Count 4.00 12.00 8.00 8.00 8.00 9.00 3.00 6.00 11.00 1.00 NA 10.00 3.00 6.00 9.00 1.00 0.00 0.00 0.00 0.00 0.00
High Speed Running Count 1.00 4.00 3.00 1.00 2.00 4.00 1.00 0.00 3.00 0.00 NA 1.00 1.00 4.00 3.00 0.00 0.00 0.00 0.00 0.00 0.00
Sprinting Count 1.00 0.00 1.00 0.00 1.00 1.00 0.00 0.00 0.00 0.00 NA 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Athlete 2 (cac92521-ef78-4bc5-8f78-2c9121037b6a) NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA

By using the tidy_data function this csv file is transformed to a tidy format

library(TidySpectrum)

data_tidy <- tidy_data(sample_data)

Output in a tidy format

metric team level id half splits value match date
Total Distance Team A group Team A first 5 5055.29 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 10 6226.41 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 15 4779.51 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 20 6256.74 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 25 6158.10 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 30 6707.47 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 35 4424.53 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 40 6307.07 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 45 6533.86 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A first 50 5019.99 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 50 6221.51 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 55 4411.40 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 60 6702.67 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 65 6702.17 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 70 3918.89 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 75 6728.53 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 80 4948.54 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 85 6567.48 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 90 5974.13 TeamA - TeamB 2022-02-21
Total Distance Team A group Team A second 95 5178.85 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 5 1810.76 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 10 1799.77 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 15 1716.37 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 20 1763.50 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 25 2013.92 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 30 1839.54 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 35 1450.40 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 40 1807.72 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 45 1706.15 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A first 50 1742.10 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 50 1812.52 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 55 1490.97 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 60 1605.79 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 65 2010.53 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 70 1472.90 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 75 1852.09 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 80 1841.09 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 85 1791.84 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 90 2010.96 TeamA - TeamB 2022-02-21
Walking Distance Team A group Team A second 95 1530.23 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 5 2251.22 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 10 2555.79 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 15 1765.35 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 20 3319.02 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 25 2872.70 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 30 3550.96 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 35 1857.71 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 40 3200.36 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 45 2922.58 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A first 50 2479.05 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 50 3102.82 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 55 1797.89 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 60 3567.68 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 65 3217.58 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 70 1440.42 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 75 3332.68 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 80 2048.26 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 85 3040.14 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 90 2813.82 TeamA - TeamB 2022-02-21
Jogging Distance Team A group Team A second 95 2557.16 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 5 639.64 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 10 1158.39 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 15 829.90 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 20 911.66 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 25 886.54 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 30 971.75 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 35 750.81 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 40 917.89 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 45 1209.04 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A first 50 664.32 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 50 929.80 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 55 595.84 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 60 1149.67 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 65 995.77 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 70 683.30 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 75 1029.11 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 80 824.01 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 85 1082.39 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 90 699.21 TeamA - TeamB 2022-02-21
Low Speed Running Distance Team A group Team A second 95 692.46 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 5 255.56 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 10 540.33 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 15 347.24 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 20 228.39 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 25 279.01 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 30 317.04 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 35 317.76 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 40 307.93 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 45 582.44 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A first 50 123.59 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 50 292.96 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 55 411.97 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 60 357.26 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 65 414.37 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 70 240.99 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 75 388.81 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 80 192.32 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 85 542.70 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 90 297.36 TeamA - TeamB 2022-02-21
High Speed Running Distance Team A group Team A second 95 336.63 TeamA - TeamB 2022-02-21