Exercise 5: Data Frames

Let's test your understanding of data frames.

Problem Statement

Create a student’s semester record. This record should include the courses the student took, their grade, and the number of lectures that student attended for that particular course.

For reference look at the figure below:

A student semester record
A student semester record

Your task is to replicate this record using data frames.

Use print() for printing the data frame; else the test cases will not pass.

Sample Output

Course LecturesTaken Grade
1   Maths            12     F
2 English            49     B
3 Science            52     A

Test Yourself

Write your code in the given area. If you get stuck, you can look at the solution.

Press + to interact
# Write your code here to correctly populate and print studentDataframe
placeholder <- c("placeholder")
studentDataframe <- data.frame(placeholder)
print(studentDataframe)