Learn some R tricks by playing with data
*** NOTE*** this R exercise page is moving to codingwithkate.com. These exercises will move there soon along with new exercises.
I recommend working in RStudio which is free. Be sure to install R (also free) before installing RStudio
Set up
Create a folder somewhere on your machine for R exercises. In that folder put the exercise .Rmd file along with the accompanying data file (which must be .csv).
Do not open RStudio from the desktop. Instead, double click the Rmd file and it'll open RStudio with the correct working directory. This is critical for being able to load in data.
Approach
The intention is that you complete the entire exercise to learn a series of new skills and learn the order in which to complete tasks. It is possible that some functions will not work how you want them to unless you do the previous steps.
Dates
Dealing with dates in R is not as straight forward as it might sound like it should be. This exercise is an example of taking what look like dates (in Excel, for example), but aren't recognized as dates by R, and reformatting them in R to be recognized as dates. Having R recognize the proper format is important for plotting.
Manipulating data entries
Sometimes the data entries in your dataframe don't look the way you want. Here's an exercise that takes an "ugly" dataset and makes it look how you (...uh...I) want it to.
Premier League Soccer Fun!
Sure, you could Google the results of the 2021-2022 English Premier League, but why not practice a bunch of R skills and build the results table yourself?
Exercise
Data