I am building a linear regression model using train data and I am receiving the error: No applicable method for 'predict' applied to an object of class "summary.lm". It happens when I try to run the mutate and predict function. I have also tried adding summary(lm..) instead but that threw another error.
    jointsplit <- initial_split(jointdata, prop = 0.7)
    
    jointtrain <- training(jointsplit)
    jointtest <- testing(jointsplit)
    
    #Q3-2
    
    linearmodel <- lm(JobSatisfaction ~ JobRole + Age + BusinessTravel + Department + DistanceFromHome + Education + EducationField + Gender + JobLevel +
       + MaritalStatus + MonthlyIncome + NumCompaniesWorked + PercentSalaryHike + StockOptionLevel + TotalWorkingYears + TrainingTimesLastYear +
       YearsAtCompany + YearsSinceLastPromotion + YearsWithCurrManager + WorkLifeBalance, data = jointtrain) %>%
    summary()
jointtest <-jointtest %>% 
  mutate(predictedsatis = predict(linearmodel, newdata = jointtest))
 
     
    