mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 18:09:39 +02:00
72 lines
2 KiB
Text
72 lines
2 KiB
Text
---
|
|
title: "freesearcheR data report"
|
|
date: "Report generated `r gsub('(\\D)0', '\\1', format(Sys.time(), '%A, %d.%m.%Y'))`"
|
|
format: docx
|
|
author: freesearcheR data analysis tool
|
|
toc: false
|
|
params:
|
|
data.file: NA
|
|
---
|
|
|
|
```{r setup, echo = FALSE}
|
|
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
|
|
# glue::glue("{format(lubridate::today(),'%A')}, {lubridate::day(lubridate::today())}.{lubridate::month(lubridate::today())}.{lubridate::year(lubridate::today())}")
|
|
```
|
|
|
|
|
|
```{r}
|
|
web_data <- readr::read_rds(file = params$data.file)
|
|
library(gtsummary)
|
|
library(gt)
|
|
|
|
tbl_merge <- function(data) {
|
|
if (is.null(names(data))) {
|
|
data |> gtsummary::tbl_merge()
|
|
} else {
|
|
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
|
|
|
|
Research should be free and open with easy access for all. The freesearcheR tool attempts to help lower the bar to participate in contributing to science by making guided data analysis easily accessible in the web-browser.
|
|
|
|
## Methods
|
|
|
|
Analyses were conducted in the *freesearcheR* data analysis web-tool based on R version 4.4.1.
|
|
|
|
## Results
|
|
|
|
Below are the baseline characteristics.
|
|
|
|
```{r, results = 'asis'}
|
|
if ("table1" %in% names(web_data)){
|
|
tbl <- gtsummary::as_gt(web_data$table1)
|
|
knitr::knit_print(tbl)}
|
|
```
|
|
|
|
`r if ("regression" %in% names(web_data)) glue::glue("Below are the results from the { tolower(vec2sentence(names(web_data$regression$tables)))} {web_data$regression$params$descr}.")`
|
|
|
|
```{r, results = 'asis'}
|
|
if ("regression" %in% names(web_data)){
|
|
reg_tbl <- web_data$regression$tables
|
|
knitr::knit_print(tbl_merge(reg_tbl))
|
|
}
|
|
```
|
|
|
|
## Discussion
|
|
|
|
Good luck on your further work!
|