After finding a regression prediction in lm I want to return only last two lines of the summary. What would be the best function to use?
my_model_lm(y ~ x1 + x2 + x3, data = [data])
summary_result <- summary(my_model)
I want to return only: Multiple R-squared: [value], Adjusted R-squared: [value] F-statistic: [value] on [value] and [value] DF, p-value: < [value]
I tried the tail() function, cat() function, summary(my_model$)r.squared at some basic level.
Was not able to return the desirable output.
You can
capture.outputthen select withtailand print withcatA complete example:
If you want to assign the output to a variable, then you can do:
Afterwards you can print it using
cat