Compare commits

..

4 commits

Author SHA1 Message Date
54dd332cd8
examples removed to enable rendering
Some checks failed
pkgdown.yaml / pkgdown (push) Has been cancelled
2025-11-19 14:07:00 +01:00
c2fa49e914
examples updated 2025-11-19 11:22:47 +01:00
67e425d510
getting started migrated as well 2025-11-19 10:56:16 +01:00
fde5a22526
docs: vignettes migrated see NEWS 2025-11-19 10:37:12 +01:00
12 changed files with 20 additions and 299 deletions

View file

@ -1,6 +1,6 @@
Package: FreesearchR
Title: Easy data analysis for clinicians
Version: 25.11.1
Version: 25.11.2
Authors@R: c(
person("Andreas Gammelgaard", "Damsbo",email="agdamsbo@clin.au.dk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7559-1154")),
@ -68,7 +68,8 @@ Imports:
readxl,
NHANES,
shiny.i18n,
stRoke
stRoke,
data.table
Suggests:
styler,
devtools,

View file

@ -1,3 +1,7 @@
# FreesearchR 25.11.2
*NEW* Vignettes were moved to the [FreesearchR project knowledge base](https://freesearchr.github.io/FreesearchR-knowledge/). This was mainly to ease rendering and allow quick and easy updates as well as future translations.
# FreesearchR 25.11.1
*NEW* Added option to select extensive baseline table selecting between "Minimal" (current) or "Extensive" which adds mean/sd and min/max as well as plots all levels also for dichotomous variables.

View file

@ -1 +1 @@
app_version <- function()'25.11.1'
app_version <- function()'25.11.2'

View file

@ -1 +1 @@
hosted_version <- function()'v25.11.1-251109'
hosted_version <- function()'v25.11.2-251119'

View file

@ -6,7 +6,6 @@
#' @returns Shiny ui module
#' @export
#'
#' @example examples/visual_summary_demo.R
visual_summary_ui <- function(id) {
ns <- shiny::NS(id)
@ -100,14 +99,6 @@ modal_visual_summary <- function(id,
#' @returns An [apexchart()] `htmlwidget` object.
#' @export
#'
#' @examples
#' data_demo <- mtcars
#' data_demo[2:4, "cyl"] <- NA
#' rbind(data_demo, data_demo, data_demo, data_demo) |> missings_apex_plot()
#' data_demo |> missings_apex_plot()
#' mtcars |> missings_apex_plot(animation = TRUE)
#' # dplyr::storms |> missings_apex_plot()
#' visdat::vis_dat(dplyr::storms)
missings_apex_plot <- function(data, animation = FALSE, ...) {
l <- data_summary_gather(data, ...)
@ -158,14 +149,6 @@ missings_apex_plot <- function(data, animation = FALSE, ...) {
#' @returns ggplot2 object
#' @export
#'
#' @examples
#' data_demo <- mtcars
#' data_demo[sample(1:32, 10), "cyl"] <- NA
#' data_demo[sample(1:32, 8), "vs"] <- NA
#' visual_summary(data_demo)
#' visual_summary(data_demo, palette.fun = scales::hue_pal())
#' visual_summary(dplyr::storms, summary.fun = data_type)
#' visual_summary(dplyr::storms, summary.fun = data_type, na.label = "Missings", legend.title = "Class")
visual_summary <- function(data, legend.title = NULL, ylab = "Observations", ...) {
l <- data_summary_gather(data, ...)
@ -217,7 +200,7 @@ visual_summary <- function(data, legend.title = NULL, ylab = "Observations", ...
#' @export
#'
#' @examples
#' mtcars |> data_summary_gather()
#' mtcars |> data_summary_gather() |> names()
data_summary_gather <- function(data, summary.fun = class, palette.fun = viridisLite::viridis, na.label = "NA", ...) {
df_plot <- setNames(data, unique_short(names(data))) |>
purrr::map_df(\(x){

View file

@ -31,5 +31,5 @@ data.frame
Data summary for printing visual summary
}
\examples{
mtcars |> data_summary_gather()
mtcars |> data_summary_gather() |> names()
}

View file

@ -69,51 +69,3 @@ Plot missings and class with apexcharter. Not in use with FreesearchR.
Ggplot2 data summary visualisation based on visdat::vis_dat.
}
\examples{
visual_summary_demo_app <- function() {
ui <- shiny::fluidPage(
shiny::actionButton(
inputId = "modal_missings",
label = "Visual summary",
width = "100\%",
disabled = FALSE
)
)
server <- function(input, output, session) {
data_demo <- mtcars
data_demo[sample(1:32, 10), "cyl"] <- NA
data_demo[sample(1:32, 8), "vs"] <- NA
data_demo$gear <- factor(data_demo$gear)
visual_summary_server(id = "data", data = shiny::reactive(data_demo),summary.fun=class)
observeEvent(input$modal_missings, {
tryCatch(
{
modal_visual_summary(id = "data")
},
error = function(err) {
showNotification(paste0("We encountered the following error browsing your data: ", err), type = "err")
}
)
})
}
shiny::shinyApp(ui, server)
}
visual_summary_demo_app()
data_demo <- mtcars
data_demo[2:4, "cyl"] <- NA
rbind(data_demo, data_demo, data_demo, data_demo) |> missings_apex_plot()
data_demo |> missings_apex_plot()
mtcars |> missings_apex_plot(animation = TRUE)
# dplyr::storms |> missings_apex_plot()
visdat::vis_dat(dplyr::storms)
data_demo <- mtcars
data_demo[sample(1:32, 10), "cyl"] <- NA
data_demo[sample(1:32, 8), "vs"] <- NA
visual_summary(data_demo)
visual_summary(data_demo, palette.fun = scales::hue_pal())
visual_summary(dplyr::storms, summary.fun = data_type)
visual_summary(dplyr::storms, summary.fun = data_type, na.label = "Missings", legend.title = "Class")
}

View file

@ -10,4 +10,9 @@ library(testthat)
library(FreesearchR)
library(shiny)
i18n <- shiny.i18n::Translator$new(translation_csvs_path = here::here("inst/translations/"))
i18n$set_translation_language("en")
test_check("FreesearchR")

View file

@ -7,163 +7,6 @@ vignette: >
%\VignetteEncoding{UTF-8}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,eval = TRUE)
library(FreesearchR)
i18n_path <- system.file("translations", package = "FreesearchR")
i18n <- shiny.i18n::Translator$new(translation_csvs_path = i18n_path)
i18n$set_translation_language("en")
```
Documentation on getting started using the FreesearchR app can be found in the [FreesearchR project documentations (link)](https://freesearchr.github.io/FreesearchR-knowledge/app/app.html).
# Getting started with ***FreesearchR***
Below is a simple walk-trough and basic descriptions on the different features of the ***FreesearchR*** app.
## Launching
The easiest way to get started is to launch [the onlie version of the app (click this link)](https://app.freesearchr.org/). Please be aware not to upload sensitive data in this version as data security can not be guaranteed in this online environment. The app can easily be run from *R* on your own computer by running the code below ([read more on running locally here](https://agdamsbo.github.io/FreesearchR/#run-locally-on-your-own-machine)):
```{r eval = FALSE}
require("pak")
pak::pak("agdamsbo/FreesearchR")
library(FreesearchR)
FreesearchR::launch_FreesearchR()
```
As a small note, a standalone Windows app version is on the drawing board as well, but no time frame is currently available.
## Get started
Once in the app, get started by loading your data. You have three options available for importing data: file upload, REDCap server export and local or sample data.
After choosing a data source nad importing data, you can preview the basic data structure and missing observations, set a threshold to filter data by completeness and further manually specify variables to include for analyses.
### File upload
Several data file formats are supported for easy import (csv, txt, xls(x), ods, rds, dta). If importing workbooks (xls(x) or ods), you are prompted to specify sheet(s) to import. If choosing multiple sheets, these are automatically merged by common variable(s), so please make sure that key/ID variables are correctly named identically.
### REDCap server export
Export data directly from a REDCap server. You need to first generate an API-token ([see these instruction](https://confluence.research.cchmc.org/pages/viewpage.action?pageId=50987698)) in REDCap. Make sure you have the necessary rights to do so.
Please don't store the API-key on your device unless encrypted or in a keyring, as this may compromise data safety. Log in to your REDCap server and retrieve the token when needed.
Type the correct web address of your REDCap server.
The module will validate the information and you can click "Connect".
This will unfold options to preview your data dictionary (the main database metadata), choose fields/variables to download as well as filtering options.
### Local or sample data
When opening the online hosted app, you can load some sample data to try out the app. When running the app locally from *R* on your own computer, you will find all data frames loaded in your environment here. This extends the possible uses of this app to allow for quick and easy data insights and code generation.
## Prepare
This is the panel to prepare data for evaluation and analyses and get a good overview of your data, check data is classed and formatted correctly, perform simple modifications and filter data.
### Summary
Here, the data variables can be inspected with a simple visualisation and a few key measures. Also, data filtering is available at two levels:
- Data type filtering allows to filter by variable [data type](https://agdamsbo.github.io/FreesearchR/articles/data-types.html)
- Observations level filtering allow to filter data by variable
### Modify
Re-class, rename, and relabel variables. Subset data, create new variables and reorder factor levels. Also, compare the modified dataset to the original and restore the original data.
## Evaluate
This panel allows for basic data evaluation.
### Characteristics
Create a classical baseline characteristics table with optional data stratification and comparisons.
### Correlation matrix
Visualise variable correlations and get suggestions to exclude highly correlated variables.
## Visuals
There are a number of plotting options to visualise different aspects of the data.
Below are the available plot types listed.
```{r echo = FALSE}
c("continuous", "dichotomous", "categorical") |>
lapply(\(.x){
dplyr::bind_cols(
dplyr::tibble("Data type"=.x),
supported_plots() |>
lapply(\(.y){
if (.x %in% .y$primary.type){
.y[c("descr","note")]|> dplyr::bind_cols()
}
})|>
dplyr::bind_rows() |>
setNames(c("Plot type","Description")))
}) |>
dplyr::bind_rows() |>
# toastui::datagrid(filters=TRUE,theme="striped") |>
knitr::kable()
```
Export the plots directly from the sidebar with easily adjusted plot dimensions for your next publication.
Also copy the code to generate the plot in your own R-environment and fine tune all the small details.
## Regression
This section is only intended for very simple explorative analyses and as a proof-of-concept for now. If you are doing complex regression analyses you should probably just write the code yourself.
Below are the available regression types listed.
```{r echo = FALSE}
c("continuous", "dichotomous", "categorical") |>
lapply(\(.x){
dplyr::bind_cols(
dplyr::tibble("Data type"=.x),
supported_functions()|>
lapply(\(.y){
if (.x %in% .y$out.type){
.y[c("descr","fun","design")]|> dplyr::bind_cols()
}
})|>
dplyr::bind_rows() |>
setNames(c("Regression model","Function","Study design")))
}) |>
dplyr::bind_rows() |>
# toastui::datagrid(filters=TRUE,theme="striped") |>
knitr::kable()
```
### Table
Generate simple regression models and get the results in a nice table. This will also be included in the exported report.
This will generate a combined table with both univariate regression model results for each included variable and a multivariate model with all variables included for explorative analyses.
### Plots
Plot the coefficients from the regression models in a forest plot. Choose which model(s) to include.
### Model checks
Check model assumptions visually. Supported checks can be chosen.
## Download
### Report
Download a nice report with baseline characteristics and regression model results. Choose between MS Word or LibreOffice format.
### Data
Export the modified dataset in different formats.
### Code
See all the code snippets from the different steps in your data evaluation.

View file

@ -16,23 +16,4 @@ knitr::opts_chunk$set(
options(rmarkdown.html_vignette.check_title = FALSE)
```
```{r setup}
library(FreesearchR)
i18n_path <- system.file("translations", package = "FreesearchR")
i18n <- shiny.i18n::Translator$new(translation_csvs_path = i18n_path)
i18n$set_translation_language("en")
```
## A clinical data class
Traditionally in *R*, data is identified by classes, like numeric, integer, double, logical, factor etc. These classes can be a little confusing from a clinical or operational standpoint. In the ***FreesearchR*** app, these classes has been simplified and modified to the following data types, that are assigned on a prioritised order like the following:
```{r echo = FALSE}
data_types() |> purrr::imap(\(.x,.i){
dplyr::bind_cols("type"=.i,.x,.name_repair = "unique_quiet")
}) |> dplyr::bind_rows() |>
setNames(c("Data type","Description","Data classes included")) |>
knitr::kable()
```
Categorising data in this way makes sense when making choices on how to evaluate and analyse data. This is used throughout the ***FreesearchR*** app to simplify data handling.
Documentation on the data types used in FreesearchR can be found in the [FreesearchR project documentations (link)](https://freesearchr.github.io/FreesearchR-knowledge/app/data_types.html).

View file

@ -15,12 +15,4 @@ knitr::opts_chunk$set(
options(rmarkdown.html_vignette.check_title = FALSE)
```
```{r setup}
library(FreesearchR)
```
## Considering missing observations
### Further reading
The authors behind the [{finalfit}-package](https://finalfit.org/index.html) have shared a very comprehensive article on what to do and think about missing observations in your data. Please [have a look here](https://finalfit.org/articles/missing.html).
Considerations of data missingness can be found in the [FreesearchR project documentations (link)](https://freesearchr.github.io/FreesearchR-knowledge/intro/missingness.html).

View file

@ -16,44 +16,4 @@ knitr::opts_chunk$set(
options(rmarkdown.html_vignette.check_title = FALSE)
```
```{r setup}
library(FreesearchR)
i18n_path <- system.file("translations", package = "FreesearchR")
i18n <- shiny.i18n::Translator$new(translation_csvs_path = i18n_path)
i18n$set_translation_language("en")
```
## Basic visualisations
The goal of ***FreesearchR*** is to keep things simple. Visuals can get very complicated. We provide a selection of plots, that helps visualise typical clinical and will be enough for most use cases, and for publishing to most journals.
If you want to go further, have a look at these sites with suggestions and sample code for data plotting:
- [*R* Charts](https://r-charts.com/): Extensive gallery with great plots
- [*R* Graph gallery](https://r-graph-gallery.com/): Another gallery with great graphs
- [graphics principles](https://graphicsprinciples.github.io/): Easy to follow recommendations for clear visuals.
### Available plots
Below are the available plot types listed.
```{r echo = FALSE}
c("continuous", "dichotomous", "categorical") |>
lapply(\(.x){
dplyr::bind_cols(
dplyr::tibble("Data type"=.x),
supported_plots() |>
lapply(\(.y){
if (.x %in% .y$primary.type){
.y[c("descr","note")]|> dplyr::bind_cols()
}
})|>
dplyr::bind_rows() |>
setNames(c("Plot type","Description")))
}) |>
dplyr::bind_rows() |>
knitr::kable()
```
Documentation on visuals used in FreesearchR can be found in the [FreesearchR project documentations (link)](https://freesearchr.github.io/FreesearchR-knowledge/app/visuals.html).