P1: Approach

Author

Andre Thomson

Approach

For Project 1, I plan to take the chess tournament text file and turn it into a CSV with one row for each player. The CSV needs five fields: name, state, total points, pre-tournament rating, and the average pre-tournament rating of the opponents each player faced.

Source Data

I am using the tournament cross-table provided for class. It lists 64 players and seven rounds. The layout is not a regular spreadsheet: each player has a row with their name and round results, followed by another row with their state and rating. I will work from tournamentinfo.txt and keep the original tournament PDF in the project folder for reference.

My Plan

I will read the text file into R and use stringr to pull out the player names, states, ratings, and round information. I plan to keep two tables while working: one with player details and another with each player’s round results. That will let me use the opponent numbers to find the correct pre-tournament ratings with a dplyr join.

After matching the opponents, I will calculate each player’s average opponent rating. Some rounds have a bye or no listed opponent, so those rounds will not be included in the average. I also need to remove provisional markers such as P17 from ratings while keeping the original numeric pre-rating.

I will then save the five required columns to chess_tournament_clean.csv. I plan to use relative file paths so the project can run from the same folder on another computer.

How I Will Check the Results

Before submitting, I will check that all 64 players appear once and that each has seven round entries. I will check that opponent numbers refer to players in the table and that the two sides of each recorded game agree. I will also compare the first player’s output with the example in the instructions: Gary Hua, ON, 6.0, 1794, 1605.

Once the CSV is saved, I will read it back into R to check the number of rows, column names, and values. These checks matter because a parsing mistake could still produce a CSV that looks fine.

Optional Graphs

If the required CSV and checks are working, I plan to include a scatterplot comparing player ratings with average opponent ratings, plus a histogram of the player pre-ratings. The graphs are only there to help explain the data. They do not replace the required CSV or the checks.

Submission Plan

I will keep the R code and explanation in the main Quarto file, include the text data needed to rerun it, and submit the GitHub repository link and published Quarto link as instructed. I will use a separate copy with speaker notes when recording my walkthrough.

References

Posit Software, PBC. (n.d.). Quarto documentation. https://quarto.org/docs/

Wickham, H., Cetinkaya-Rundel, M., & Grolemund, G. (2023). R for data science (2nd ed.). O’Reilly Media. https://r4ds.hadley.nz/