-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
91 lines (64 loc) · 3.83 KB
/
README.Rmd
File metadata and controls
91 lines (64 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>",
fig.path = "man/figures/README-", out.width = "80%")
library(modelit)
library(tabularise)
library(chart)
```
# 'SciViews::R' - Statistical Models <a href='https://www.sciviews.org/modelit'><img src='man/figures/logo.png' align='right' height='138'/></a>
<!-- badges: start -->
[](https://github.com/SciViews/modelit/actions/workflows/R-CMD-check.yaml)
[](https://codecov.io/gh/SciViews/modelit?branch=main)
[](https://cran.r-project.org/package=modelit)
[](https://sciviews.r-universe.dev/modelit)
[](https://opensource.org/licenses/MIT)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
The {modelit} package adds the statistical models to the SciViews::R dialect. It uses both the `fun$type(data = ...., formula)` approach and the enhanced formula allowing to specify arguments with `%arg=%` directly inside the formula. It also takes the variable labels into account in the outputs.
The {modelit} package provides methods (**lm**, **glm**; **nls** objects) for the `chart()` function in the {chart} package and the `tabularise()` function in the {tabularise} package.
## Installation
{modelit} is not available from CRAN yet. You should install it from the [SciViews R-Universe](https://sciviews.r-universe.dev). {chart} is an alternate formula interface to {ggplot2}. {tabularise} produces publication-ready (rich-formatted) tabular output. The {equatags} and {equatiomatic} packages are optional, but they are useful to display equations, both inline in R Markdown/Quarto documents and in {tabularise} tables. {svBase} is useful too because it manages labels and units that {chart} uses. To install these six packages and their dependencies, run the following command in R:
```{r, eval=FALSE}
install.packages(c('modelit', 'chart', 'tabularise', 'equatags', 'equatiomatic', 'svBase'),
repos = c('https://sciviews.r-universe.dev', 'https://cloud.r-project.org'))
```
You can also install the latest development version of {modelit}. Make sure you have the {remotes} R package installed:
```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("SciViews/modelit")
```
## Short example
```{r}
library(modelit)
library(tabularise)
library(chart)
```
The trees datasets present diameter, height and volume for Black Cherry Trees (*Prunus serotina*, Ehrh., 1788)
```{r}
data('trees', package = 'datasets')
```
We perform a polynomial regression of the volume of timber as a function of the girth of the trees.
```{r}
trees_lm <- lm(Volume ~ Girth + I(Girth^2), data = trees)
summary(trees_lm)
```
Here is the summary of the model, using `tabularise()`:
```{r, eval=FALSE}
summary(trees_lm) |> tabularise()
```
<img src="man/figures/README-tabularise-chunk.png" width="80%"/>
The model can be viewed using `chart()`:
```{r}
chart(trees_lm)
```
Residual analysis plots can also be carried out with `chart()`.
```{r}
chart$residuals(trees_lm)
```
For further examples, please, refer to the help pages at <https://www.sciviews.org/modelit/>.
## Code of Conduct
Please note that the {modelit} package is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.