8. Extending a data frame. In some cases, we will want to extend a data frame by adding another column. We will often do this after
transforming a variable. You can add a column to the dataframe df
with the syntax df$column_name = variable
.
You are given a data frame, bond_data
that contains two columns: rate
and risk_free
. Compute the excess return
and assign it to a column named excess_return
.