forked from NikNakk/forestmodel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
76 lines (58 loc) · 2.47 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# forestmodel
<!-- badges: start -->
[![Build Status](https://travis-ci.org/NikNakk/forestmodel.svg?branch=master)](https://travis-ci.org/NikNakk/forestmodel)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/NikNakk/forestmodel?branch=master&svg=true)](https://ci.appveyor.com/project/NikNakk/forestmodel)
[![](http://cranlogs.r-pkg.org/badges/grand-total/forestmodel?color=blue)](https://cran.r-project.org/package=forestmodel)
[![R build status](https://github.com/NikNakk/forestmodel/workflows/R-CMD-check/badge.svg)](https://github.com/NikNakk/forestmodel/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/forestmodel)](https://CRAN.R-project.org/package=forestmodel)
[![Codecov test coverage](https://codecov.io/gh/NikNakk/forestmodel/branch/master/graph/badge.svg)](https://codecov.io/gh/NikNakk/forestmodel?branch=master)
<!-- badges: end -->
This is an R package to generate forest plots of the coefficients of models produced
by `lm`, `glm`, `survival::coxph`, etc.
The main function is `forest_model`, with a helper function `default_forest_panels` to produce
the necessary `panels` `data.frame`.
## Installation
The package can be installed using `install.packages`. It needs Hadley Wickham's
`broom`, `dplyr`, `gpplot2` and `lazyeval` packages.
Development takes place on the github repository https://github.com/NikNakk/forestmodel/.
## Installation
You can install the released version of forestmodel from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("forestmodel")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("NikNakk/forestmodel")
```
## Example
```{r example, message = FALSE}
library(forestmodel)
library(survival)
library(dplyr)
pretty_lung <- lung %>%
transmute(time,
status,
Age = age,
Sex = factor(sex, labels = c("Male", "Female")),
ECOG = factor(lung$ph.ecog),
`Meal Cal` = meal.cal)
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung)))
```
Specifying the covariates to show:
```{r, select_variables}
print(forest_model(coxph(Surv(time, status) ~ ., pretty_lung),
covariates = c("Age", "Sex")))
```