Challenge 3: Find the Highest Achiever
Explore how to write an R function that reads data from math, English, and science CSV files and calculates the total scores to find the student with the highest combined marks. This lesson helps you practice vector manipulation and file handling by working on a real-world data analysis challenge.
We'll cover the following...
Problem Statement
Implement a function findTopper() that takes input from three subject files: math.csv, english.csv and science.csv, and find the index of the student that has scored the maximum total marks adding all three of its marks.
Input
Three files: math.csv, english.csv and science.csv
Output
Index of the highest scoring student
Sample Input
math.csv
Name, Math
Andrew, 2.5
Mathew, 5.9
Dany, 1.9
Philip, 9.1
english.csv
Name, English
Andrew, 8.2
Mathew, 2.5
Dany, 7.5
Philip, 9.3
science.csv
Name, Science
Andrew, 5.2
Mathew, 9.5
Dany, 7.1
Philip, 1.9
Sample Output
4
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.
In the next lesson, we give a brief overview of the solution to this problem.