Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I have R programming questions. I need your help. Thank you. f3. In daily fantasy sports it is often helpful to calculate a player's

Hello, I have R programming questions.

I need your help.

Thank you.

image text in transcribedimage text in transcribedimage text in transcribed
\f3. In daily fantasy sports it is often helpful to calculate a player's \"Boom / Bust\" percentages. A player's \"Boom\" percentage (at least for me) is the likelihood my algorithm thinks the fantasy points they earn will be 5 times their salary or more, while the \"Bust\" percentage is the likelihood they will earn less than 5 times their salary. Obviously, it is far more advantageous to roster players whose \"Boom\" percentage is higher than their \"Bust\" percentage. In this question we are going to use if() , else () and 1while () statement(s) to create a new dataframe called goodbad that lists the players in the \"Good\" column if they're more likely to boom and lists players in the \"Bad\" column if they are more likely to bust. (a) Read in the boombust . cav file and save it to bb (b) Omit any NA rows by running the code: bb = na. omit (bb) (c) It will be useful to know the length of the dataset, so run the code: n = dim(bb) [1] which saves the number of rows of the dataset to the variable n. (d) We need to create a new dataframe to store our Good / Bad player names. To do this run the following two lines of code: i. goodbad = data. frame (matrix (ncol = 2, nrow = n) ) ii. colnames (goodbad) = c("Good", "Bad") (e) Write a while statement with an if-else statement inside of it to traverse the bb dataset. For each row of bb you will need to calculate whether the player's boom is greater than or equal to their bust. Use j as your index variable. If the player's boom is greater than or equal to their bust, save the player's name to the "Good" column of goodbad, and if their bust is greater than their boom save the player's name to the "Bad" column of goodbad. (f) Use the following code to print out the number of players classified as "Good": length (goodbad$Good [!is . na(goodbad$Good)]) (g) Use the following code to print out the number of players classified as "Bad": length (goodbad$Bad [!is . na (goodbad$Bad) ])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Personal Tutor For Serways Essentials Of College Physics,

Authors: Raymond A Serway, Chris Vuille

1st Edition

0495171646, 9780495171645

More Books

Students also viewed these Mathematics questions

Question

Engage everyone in the dialogue

Answered: 1 week ago