I have built this linear regression model on top of the 'mtcars' data-set:

`lm(mpg~disp+hp,data = mtcars)->mod1`

Now, i'd want to see only the r.squared and p-value from the linear regression summary result.

```summary(mod1)

Call:

lm(formula = mpg ~ disp + hp, data = mtcars)

Residuals:

Min      1Q  Median      3Q     Max

-4.7945 -2.3036 -0.8246  1.8582  6.9363

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 30.735904   1.331566  23.083  < 2e-16 ***

disp        -0.030346   0.007405  -4.098 0.000306 ***

hp          -0.024840   0.013385  -1.856 0.073679 .

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 3.127 on 29 degrees of freedom

Multiple R-squared:  0.7482, Adjusted R-squared:  0.7309

F-statistic: 43.09 on 2 and 29 DF,  p-value: 2.062e-09

```
May 22, 2018 883 views

## 1 answer to this question.

You can use the \$ symbol to select only the r.squared value:

`summary(mod1)\$r.squared`

Similarly, you have to select the 4th column from the 'coefficients':

`summary(mod1)\$coefficients[,4]`
answered May 22, 2018 by
• 4,660 points

## Dynamically select element from a list and work with it - Shiny R

Follow these steps: Import the data into R Check ...READ MORE

+1 vote

## I’m a noob to R and I’m supposed to printing all even numbers from 1 to 100. Can somebody help me with it?

Try this: Two <- seq(2,100,2) READ MORE

## Split a string and store it in multiple columns from a field in R

How to Split a string and store ...READ MORE

## Read from database and store in R as dataframe

Your code would fetch you a MySQL ...READ MORE

## Steps to evaluate Linear Regression in R

These are sequential steps which need to ...READ MORE

## Predict weight when height is given using linear regression in R

You can try something like this: # The ...READ MORE

+1 vote

## R programming: Linear programming problems

The documentation for the lp package provides ...READ MORE

## R programming: Linear Equation

Use expand.grid to get all possible combinations ...READ MORE
{"ft_lang_label":"__label__en","ft_lang_prob":0.55453795,"math_prob":0.87778705,"size":756,"snap":"2022-40-2023-06","text_gpt3_token_len":305,"char_repetition_ratio":0.08111702,"word_repetition_ratio":0.0,"special_character_ratio":0.4973545,"punctuation_ratio":0.23958333,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97209203,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-09-25T20:53:40Z\",\"WARC-Record-ID\":\"<urn:uuid:93425a15-4c3a-4728-af67-6b79f8d22ab8>\",\"Content-Length\":\"152410\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:149b9ccd-67c0-4cc9-ba96-aa682f84372a>\",\"WARC-Concurrent-To\":\"<urn:uuid:83d1ff84-25f7-4688-ad44-b826750537b5>\",\"WARC-IP-Address\":\"99.86.224.12\",\"WARC-Target-URI\":\"https://www.edureka.co/community/4624/selecting-value-squared-value-from-linear-regression-result?show=4625\",\"WARC-Payload-Digest\":\"sha1:GLLQOVQJNMAPIFC7ZCGK6CWIGD5MUPIW\",\"WARC-Block-Digest\":\"sha1:THTUWMKBIPL2WGVTD6VZBQJFQ2D4O6OA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030334596.27_warc_CC-MAIN-20220925193816-20220925223816-00429.warc.gz\"}"}