Question: Exercise 3 We're now going to explore the most common data structures deployed in R , dataframes. In this exercise, we will create a dataframe

Exercise 3
We're now going to explore the most common data structures deployed in R, dataframes. In this exercise, we will create a dataframe from the vectors we
generated above and perform operations on our dataframe.
Q1. Create a dataframe called class_df using the vectors you created in Exercise 2. Your dataframe should have two columns and six rows. Don't
change the column names (i.e. keep them as names and grades).
In []: M # Write your code here. Be careful to follow the instructions!
In []: M # Just-in-time check!
# Run this cell, if it fails, you likely have a mistake above. You will be marked on whether the full answer is
expect_true(is.data.frame(class_df))
rbind (...) and cbind(...)
The rbind() and cbind() functions takes a sequence of arguments and combines them by rows or columns respectively.
It's a convenient way of adding rows or columns to a data frame.
More information on this function can be found here.
Q2. Add a new entry to your dataframe for a student named Joan who received a grade of 92. Your new dataframe should still be called class df

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!