66.2k views
2 votes
Import the 649.csv dataset. This dataset has all of the winning 6/49 lottery numbers from 1982 to 2018. (The way this lottery works is the numbers 1-49 are put onto balls and 7 (6 and 1 bonus number) of those balls are drawn, note the ball is NOT put back after it is drawn so it can only be chosen once per draw, but it can be drawn in any order as the numbers are NOT sorted) a) After importing the file into R, create a smaller data frame that consists of the draw number and the date that the draw occurred for every draw where the numeric day of your birth was drawn.(note, your birthday number could have been drawn for any of the numbers including the bonus number, so you might have to check multiple times!). Build one singular data frame that shows all of the draw dates where your birth number was drawn. b) Print out to the terminal the total number of draws where your birthday number was drawn in your Rscript file. c) Print out the draw number drawn slot which the MOST instances of your birthday number was drawn (including the bonus draw number) and say how many times your birthday number was drawn.

User Hovado
by
7.8k points

1 Answer

5 votes

Final answer:

To import the 649.csv dataset in R and create a data frame that consists of draw numbers and dates where the birth number was drawn, use the 'read.csv()' and 'subset()' functions respectively. To print out the total number of draws, use the 'nrow()' function.

Step-by-step explanation:

To import the 649.csv dataset in R, you can use the 'read.csv()' function. Here's an example:

dataset <- read.csv('649.csv')

To create a smaller data frame that consists of the draw number and the date for every draw where your birth number was drawn, you can use the 'subset()' function. Here's an example:

birth_df <- subset(dataset, dataset$numeric_day_of_birth == birth_number, select = c(draw_number, draw_date))

To print out the total number of draws where your birthday number was drawn, you can use the 'nrow()' function. Here's an example:

total_draws <- nrow(birth_df)
User Kkakkurt
by
8.0k points