Skip to content

Commit

Permalink
final commit before cran?
Browse files Browse the repository at this point in the history
  • Loading branch information
WillTirone committed Jan 19, 2024
1 parent 2c82704 commit 3457e8e
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 57 deletions.
19 changes: 15 additions & 4 deletions R/combine.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@
#' @export
#'
#' @examples
#' # lm example -------------------------------------------
#' lm_1 = lm(mpg ~ cyl + disp + hp, data = mtcars)
#' lm_2 = lm(mpg ~ hp + drat + wt, data = mtcars)
#' lm_3 = lm(mpg ~ ., data = mtcars)
#' lm_combined = stack_metrics(lm_1, lm_2, lm_3)
#' print(lm_combined)
#' lm_combined
#'
#' # glm example ------------------------------------------
#' glm_1 = glm(vs ~ drat + hp, data = mtcars)
#' glm_2 = glm(vs ~ wt + qsec, data = mtcars)
#' glm_3 = glm(vs ~ ., data = mtcars)
#' glm_combined = stack_metrics(glm_1, glm_2, glm_3)
#' print(glm_combined)
#' glm_combined
#'
#' # lme4 example -----------------------------------------
#' lmer_1 = lme4::lmer(Sepal.Length ~ (1 | Species), data = iris)
#' lmer_2 = lme4::lmer(Sepal.Length ~ (1 | Species) + Petal.Length, data = iris)
#' lmer_combined = stack_metrics(lmer_1, lmer_2)
#' print(lmer_combined)
#' lmer_combined
stack_metrics = function(...) {

models = list(...)
Expand Down Expand Up @@ -78,22 +81,30 @@ stack_metrics = function(...) {
#' [tibble()] for easy comparison across models.
#'
#' @param ... lm or glm models to summarize and combine.
#' @param ci width of confidence, default = 0.95
#' @param ci width of confidence, default = 0.95.
#'
#' @return A [tibble()] with coefficients, confidence intervals, and standard
#' errors.
#' @export
#'
#' @examples
#' # multiple lm example ----------------------------------
#' lm_1 = lm(mpg ~ cyl + disp + hp, data = mtcars)
#' lm_2 = lm(mpg ~ hp + drat + wt, data = mtcars)
#' lm_3 = lm(mpg ~ ., data = mtcars)
#' lm_combined = stack_coeff(lm_1, lm_2, lm_3)
#' lm_combined
#'
#' # sometimes you might just want 1 model's summary ------
#' single_lm = stack_coeff(lm_1)
#' single_lm
#'
#' # glm example ------------------------------------------
#' glm_1 = glm(vs ~ drat + hp, data = mtcars)
#' glm_2 = glm(vs ~ wt + qsec, data = mtcars)
#' glm_3 = glm(vs ~ ., data = mtcars)
#' glm_combined = stack_coeff(glm_1, glm_2, glm_3)
#' glm_combined
stack_coeff = function(..., ci = 0.95) {

models = list(...)
Expand Down
20 changes: 3 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[![R-CMD-check](https://github.com/WillTirone/modelfactory/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/WillTirone/modelfactory/actions/workflows/R-CMD-check.yaml)
[![test-coverage](https://github.com/WillTirone/modelfactory/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/WillTirone/modelfactory/actions/workflows/test-coverage.yaml)
<!-- badges: end -->

<img src="man/figures/logo.png" align="right" height="138" />

# About

Expand All @@ -29,20 +31,4 @@ See the [references](https://willtirone.github.io/modelfactory/reference) tab fo

# Contributing

Contributions are encouraged and welcomed, feel free to submit a PR or open an
issue!

# CRAN Submission / TODO

- remove unnecessary README stuff
- delete inst
- finish / verify that the functions have roxygen correct
- add examples to readme
- add to NEWS.md
- read release section again and use use_release_issue()

# TODO:
- expects output

# Change
- look at r hub
Contributions are encouraged and welcomed, feel free to submit a PR or open an issue!
28 changes: 0 additions & 28 deletions inst/scratchwork.qmd

This file was deleted.

10 changes: 9 additions & 1 deletion man/stack_coeff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions man/stack_metrics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3457e8e

Please sign in to comment.