R challenge: University subject analysis
Knowledge check
Test your R skills developed from completing the first two worksheets. You are tasked with seeing how LSE compares to other universities in the number of students taking different subjects.
Can you solve this coding challenge without support from a trainer, peers, or AI? Solely relying on the R techniques you have learned so far, and your web searching skills?
Completing this project is the perfect way to test your learning!
The challenge
Your task is to write R code that provides you with a table comparing the average number of students by subject area and university (LSE versus other universities).
You will need to:
- Make a new column that has the following categories -
LSE
andOther universities
- Calculate the average number of students by subject area and by the above category you made
When you run your code it should load in your dataset, apply the above data preparation, and give you a table of the results. From your results you should be able to answer the following questions:
- Which subject area at LSE has the highest average number of students?
- Which subject area at the other universities has the highest average number of students?
The data can be loaded into R using the following URL: https://raw.githubusercontent.com/andrewmoles2/HE-students/refs/heads/main/data/he_subjects_20_24.csv
.
The data is from the HESA website, which has been prepared for you. The dataset shows what subject areas students are doing at different universities. It covers academic years from 2014/2015 to 2023/2024.
We recommend you open a new R Markdown or R Script for this challenge by going to File -> New File ->
and selecting Markdown or R Script. Be sure to save your work in the same folder as the rest of your code when you are done.
How do I know if got it right?
Answer some questions in this quiz to test out if you got the expected outcome.
As a bonus, you will get our solution at the end of the quiz.