Guided Project: Mobile App for Lottery Addiction (in R)

Hey All,

I just wanted to share my work on this guided project. I found this project to be quite fun given my familiarity with both the 6/49 lottery and addiction (as someone who lives in Toronto and completed graduate studies in this field of study). Was able to complete a bit of the additional work outlaid at the end of the page as well.

Have a look and let me know if there is something that can be improved on or if you happen to run into an issue with a line of code somewhere. I know in one of the last R projects that I shared, some of you had ran into an error that didn’t work for some unknown reason, but others had no issue.

  • Mike

Here is a link to my Github.

Guided Project - Mobile App for Lottery Addiction.R (20.9 KB)

1 Like

Hi Mike,
Nice work! This is comprehensive and well written.

I was able to run all of the code in the notebook with two minor modifications. First, I opened a new R Markdown file for this script in an RStudio project, and then I saved the CSV file in the folder for that project. That allowed me to use this relative file path to open the CSV (side note, that’s one of my favorite features about R Studio projects):

lotto = read.csv("649.csv")

Second, I commented out the match variable because it was being included for discussion purposes as an example only. Once I did this, I could run the R Markdown notebook from top-to-bottom:

# match <- map(my_numbers, function(x) {setequal(x, winning_numbers)})

Thank you for sharing!

Hey @casey,

Thanks for looking it over. I was kinda worried about it since I originally wrote everything on an R file and then transfer everything over to an R Markdown notebook and putting it up onto Github, which I usually do on default. I know it’s a bad habit, but for whatever reason, I prefer to use the R file.

In any case, appreciate the double-check and review.

Hey @michael.hoang17. If you prefer authoring in an R file, check out Tip #6 from this Dataquest blog post on how to convert your R file to R Markdown. I’ve met researchers that only author R Markdown files in this way.


1 Like