Working with splines

We will use the ames data set from the modeldata library. It can be loaded using the following code

We will try to predict the Sale_Price of a house by the Longitude of its location (this would not be the best idea alone, but serves as an example). Use step_bs() to fit a spline onto Longitude use cross-validation to find the value of degree where the model performs best.