Skip to content

Commit

Permalink
add binding method c.report_table
Browse files Browse the repository at this point in the history
  • Loading branch information
DominiqueMakowski committed Oct 10, 2022
1 parent 3568386 commit 4fa2898
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ S3method(as.report_table,default)
S3method(as.report_table,report)
S3method(as.report_text,default)
S3method(as.report_text,report)
S3method(c,report_table)
S3method(format,report_table)
S3method(format_model,character)
S3method(format_model,default)
Expand Down Expand Up @@ -265,6 +266,7 @@ export(cite_citation)
export(cite_easystats)
export(cite_packages)
export(clean_citation)
export(display.report_table)
export(format_algorithm)
export(format_citation)
export(format_formula)
Expand Down
11 changes: 11 additions & 0 deletions R/report_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ print.report_table <- function(x, ...) {



#' @export
c.report_table <- function(...) {
x <- list(...)

out <- x[[1]]
for(i in 2:length(x)) {
out <- datawizard::data_join(out, x[[i]], join = "bind")
}
out
}


# helper to create table captions and footer -----------------------

Expand Down
19 changes: 18 additions & 1 deletion vignettes/report_table.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,25 @@ In fact, the function used to *prettify* the output is called `format_table()` a
format_table(as.data.frame(t), stars=TRUE)
```

Also, you can join the results of multiple tables:

## Regression Models
```{r}
results1 <- t.test(mpg ~ am, data=mtcars)
results2 <- t.test(wt ~ am, data=mtcars)
results3 <- t.test(qsec ~ am, data=mtcars)
c(report_table(results1),
report_table(results2),
report_table(results3)) |>
display()
```


## ANOVAs



## Linear Models

```{r}
model <- lm(Petal.Length ~ Species * Petal.Width, data = iris)
Expand Down

0 comments on commit 4fa2898

Please sign in to comment.