Developing Data Products Assigment

My Tennis App

Najma Rajah
Author of Game, Set and Stats

Introduction

The assignment for Week 4 of the developing data products specialisation requires the student to develop and app. This presentation provides the following information:

  1. A description of the data used within the app
  2. A description of the app which can be used to predict a tennis player's weight based on information on their height, including instructions on how to use the app and its benefits
  3. An example of the output from the app

A description of the data

This app draws on data obtained from the Association of Professional Tennis players' website. The data set comprises the heights (in cms) and weights (in Kgs) of the top 100 male players in the world during the week commencing 1 Jan 2019. The data set also includes a wide range of other information including the name of the player, their ranking position, their age and their BMI.

ATPsize<-read.csv("~/myTennisApp/ATP data.csv", header=TRUE, stringsAsFactors = FALSE)
summary(ATPsize$Heightcms)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   170.0   183.0   188.0   188.2   193.0   211.0
summary(ATPsize$Weightkg)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   64.00   77.00   81.50   82.05   86.25  108.00

A description of the app

The app can be used to predict a tennis player's height based on their weight. The side panel of the app allows the user to input the weight of the tennis player in cms.

The output of the app is shown in the main panel. It comprises two elements.

First there is a scatter plot which shows the relationship between the height and the weight of the top 100 male tennis players in the world.

Then the app predicts the weight given the weight that was selected by using the slider, based on the lm function. An interactive version of the app is available at https://najmarajah.shinyapps.io/tennis/ and the R code to build the app is available at https://github.com/rajahn01/Developing-data-products-assignment

The app can be used to show what the ideal weight for a tennis player of a certain height should be. It can also be used to identify whether a male of a certain weight and height is likely to be successful in the sport at the highest level.

Scatter plot showing the relationship between a player's weight and their height.

model1<-lm(Weightkg~Heightcms, data=ATPsize)
chart<-plot(ATPsize$Heightcms, ATPsize$Weightkg, xlab = "Height in cms", 
                     ylab = "Weight in Kgs", main="Male tennis players' weights & heights", pch = 16, xlim = c(170, 215), ylim = c(60, 110))
abline(model1, col="red",lwd=2)

plot of chunk unnamed-chunk-2