Introduction to R Programming - University of York
Preface
These lecture notes have been created as supplementary material for the “Introduction to R Programming” workshops and are mostly built up from the R scripts seen in the timetabled sessions, as well as some additional comments. At the end of each chapter, you will also find a set of exercises, the solutions for which will be added as we progress through the course.
These notes are a work in progress and will be updated over time, so please make sure to revisit them on a regular basis. If there is anything missing from these notes that you believe would be beneficial or if you notice any mistakes, please let me know so I can improve them as best I can. Remember, they are here for your benefit so it would be great to have your input too.
About This Course
This course is by no means exhaustive and is designed to introduce you to the basics of programming in R, improve your confidence with code-based problem solving and signpost you to additional resources to further enhance your skills.
The course is non-credit bearing and thus, there are no formal assessments for you to submit. However, at the end of each week/chapter there are a number of exercises which I strongly recommend you complete. The best way to learn and improve your programming skills is by doing it yourself and learning how to overcome the obstacles/errors that you will inevitably encounter. Remember, do not be afraid to search the internet or ask AI for hints and ideas when programming, it is usually the most effective way to solve your problems, I have to do it myself regularly!
Schedule
As this is a non-credit bearing course, the syllabus and schedule are flexible and can be delivered as we see fit. However, the content will be roughly cover the following topics:
- Getting to know R and RStudio
- R programming basics
- Value and object types
- Extraction
- Conditional and IF statements
- FOR/WHILE loops
- Functions
- Data in R
- Debugging
DataCamp
In order to assist you in your journey to learning all about R and RStudio, this course is supplemented via an online interactive tutorial website known as DataCamp.
In DataCamp, you will have access to hundreds of interactive courses for R (and other languages such as Python and SQL), each tailored to a different aspect of the fundamentals of R programming or an area of application. In general, only a few of these courses are free to use, with the remaining requiring a paid subscription for access. However, for those of you taking the ‘Introduction to R programming’ workshops, you will have free access to the full library of courses for 6 months. Registration for this free access will be discussed in the workshops themselves and is only available to those invited by the lecturer via an email link. To learn more about DataCamp and what it has to offer visit .
As mentioned above, DataCamp will be used as a supplementary resource for this course and we strongly encourage you to use it. Below are links directing you to appropriate courses within DataCamp that we believe complement the material:
- https://www.datacamp.com/courses/free-introduction-to-r (R Basics - Recommended)
- https://app.datacamp.com/learn/courses/introduction-to-r-for-finance (Introduction to R for Finance)
- https://www.datacamp.com/courses/intermediate-r (Intermediate R Course)
- https://app.datacamp.com/learn/courses/intermediate-r-for-finance (Intermediate R for Finance Course)
- https://www.datacamp.com/courses/data-visualization-in-r (Plotting Data)
- https://www.datacamp.com/courses/data-visualization-with-ggplot2-1 (Plotting Data using ggplot)
- https://www.datacamp.com/courses/data-visualization-with-ggplot2-2
- https://www.datacamp.com/courses/data-visualization-with-ggplot2-part-3