added regression types to text

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-01-23 14:25:04 +01:00
parent d51fd27996
commit 2554ce50a4
No known key found for this signature in database
2 changed files with 15 additions and 3 deletions

View file

@ -5,6 +5,6 @@ account: cognitiveindex
server: shinyapps.io server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1 hostUrl: https://api.shinyapps.io/v1
appId: 13786206 appId: 13786206
bundleId: 9688503 bundleId: 9688582
url: https://cognitiveindex.shinyapps.io/freesearcheR_dev/ url: https://cognitiveindex.shinyapps.io/freesearcheR_dev/
version: 1 version: 1

View file

@ -9,7 +9,7 @@ params:
--- ---
```{r setup, echo = FALSE} ```{r setup, echo = FALSE}
knitr::opts_chunk$set(echo = FALSE, message=FALSE, warning=FALSE) knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
``` ```
@ -25,6 +25,18 @@ tbl_merge <- function(data) {
data |> gtsummary::tbl_merge(tab_spanner = names(data)) data |> gtsummary::tbl_merge(tab_spanner = names(data))
} }
} }
vec2sentence <- function(data, sep.word = "and") {
sep.word <- paste0(" ", gsub(" ", "", sep.word), " ")
if (length(data) < 2) {
out <- data
} else if (length(data) == 2) {
out <- paste(data, collapse = sep.word)
} else {
out <- paste(paste(data[-length(data)], collapse = ","), data[length(data)], sep = sep.word)
}
return(out)
}
``` ```
## Introduction ## Introduction
@ -44,7 +56,7 @@ tbl <- gtsummary::as_gt(web_data$table1)
knitr::knit_print(tbl) knitr::knit_print(tbl)
``` ```
Below are the results from the Below are the results from the `r tolower(vec2sentence(names(web_data$regression$tables)))` `r web_data$regression$params$descr`.
```{r, results = 'asis'} ```{r, results = 'asis'}
reg_tbl <- web_data$regression$tables reg_tbl <- web_data$regression$tables