Using confint(lm) gives a confidence interval for a linear regression model. How would I pull those values to use in a sprintf function? In other words, what would I put after the comma in the sprintf function to substitute for %s? I tried using confint(lm1)[1] but get an error saying invalid format.
sprintf("The 95% confidence interval (CI) for the slope is (%s,%s)", confint(lm1)[1], confint(lm1)[2])
In this example, the values I’d want to access are 4.4902102 and 6.9175080.
> confint(lm1)
2.5 % 97.5 %
(Intercept) 4.4902102 6.9175080
csv_data$Consumer_Debt -0.1343205 0.2006446