# R tip: Make Your Results Clear with sigr

R is designed to make working with statistical models fast, succinct, and reliable.

For instance building a model is a one-liner:

```model <- lm(Petal.Length ~ Sepal.Length, data = iris)
```

And producing a detailed diagnostic summary of the model is also a one-liner:

```summary(model)

# Call:
# lm(formula = Petal.Length ~ Sepal.Length, data = iris)
#
# Residuals:
#      Min       1Q   Median       3Q      Max
# -2.47747 -0.59072 -0.00668  0.60484  2.49512
#
# Coefficients:
#              Estimate Std. Error t value Pr(>|t|)
# (Intercept)  -7.10144    0.50666  -14.02   <2e-16 ***
# Sepal.Length  1.85843    0.08586   21.65   <2e-16 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# Residual standard error: 0.8678 on 148 degrees of freedom
# Multiple R-squared:   0.76,   Adjusted R-squared:  0.7583
# F-statistic: 468.6 on 1 and 148 DF,  p-value: < 2.2e-16
```

However, useful as the above is: it isn’t exactly presentation ready. To formally report the R-squared of our model we would have to cut and paste this information from the summary. That is a needlessly laborious and possibly error-prone step.

With the `sigr` package this can be made much easier:

```library("sigr")
Rsquared <- wrapFTest(model)
print(Rsquared)

#  "F Test summary: (R2=0.76, F(1,148)=468.6, p<1e-05)."
```

And this formal summary can be directly rendered into many formats (Latex, html, markdown, and ascii).

```render(Rsquared, format="html")
```

F Test summary: (R2=0.76, F(1,148)=468.6, p<1e-05).

`sigr` can help make your publication workflow much easier and more repeatable/reliable.

Categories: Tutorials Uncategorized

Tagged as: ### jmount

Data Scientist and trainer at Win Vector LLC. One of the authors of Practical Data Science with R.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7680037,"math_prob":0.89196897,"size":1655,"snap":"2023-40-2023-50","text_gpt3_token_len":525,"char_repetition_ratio":0.09267111,"word_repetition_ratio":0.0078125,"special_character_ratio":0.36132932,"punctuation_ratio":0.20661157,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97867143,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-10-02T05:16:27Z\",\"WARC-Record-ID\":\"<urn:uuid:7d92dc1c-9ede-41b7-a13b-d15554acbe3e>\",\"Content-Length\":\"51459\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:73e51eba-2a6b-4b8e-b131-081f7a7f3584>\",\"WARC-Concurrent-To\":\"<urn:uuid:ea42abcf-c74f-4268-849e-0d056d4972f9>\",\"WARC-IP-Address\":\"192.0.78.211\",\"WARC-Target-URI\":\"https://win-vector.com/2018/11/04/r-tip-make-your-results-clear-with-sigr/\",\"WARC-Payload-Digest\":\"sha1:SBCQSN2RKA4LJN3NLJF6ZBAJ57LE7XAV\",\"WARC-Block-Digest\":\"sha1:ZJR56THOJVCBHBFSXEGBXMUMUULJ5DLX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510967.73_warc_CC-MAIN-20231002033129-20231002063129-00020.warc.gz\"}"}