This commit is contained in:
Andreas Gammelgaard Damsbo 2025-03-19 09:14:36 +01:00
parent 68c93d94e4
commit 04784a7a24
No known key found for this signature in database
34 changed files with 120 additions and 136 deletions

View file

@ -1,4 +1,4 @@
Package: freesearcheR
Package: FreesearchR
Title: Browser Based Data Analysis
Version: 25.3.2
Authors@R:

View file

@ -20,4 +20,4 @@ LineEndingConversion: Posix
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
PackageRoxygenize: rd,collate,namespace,vignette

View file

@ -48,7 +48,7 @@ export(is_consecutive)
export(is_datetime)
export(is_valid_redcap_url)
export(is_valid_token)
export(launch_freesearcheR)
export(launch_FreesearchR)
export(line_break)
export(m_datafileUI)
export(m_redcap_readServer)
@ -81,7 +81,6 @@ export(remove_na_attr)
export(repeated_instruments)
export(sankey_ready)
export(selectInputIcon)
export(shiny_freesearcheR)
export(specify_qmd_format)
export(subset_types)
export(supported_functions)

View file

@ -2,11 +2,11 @@
Focus is on polish and improved ui/ux.
First steps towards an updated name (will be FreesearchR), with renamed repository. Also, the repo will move to an organisation (named FreesearchR).
First steps towards an updated name (will be FreesearchR), with renamed repository. This may introduce some breaking chances for others calling or installing the package. No future changes are planned. A complete transition is planned before attending and presenting a poster at the European Stroke Organisation COnference 2025 in May.
Testing file upload conducted and improved.
Working on omproving code export.
Working on improving code export.
# freesearcheR 25.3.1

2
QA.md
View file

@ -1,6 +1,6 @@
# Questions and answers
A complete instructions set is not available, but below are a collection of questions and answers about the project and use of the app.
A complete instructions set [is also available](https://agdamsbo.github.io/FreesearchR/articles/FreesearchR.html), but below are a collection of questions and answers about the project and use of the ***FreesearchR*** app.
## Are you keeping the uploaded data?

View file

@ -1 +1 @@
app_version <- function()'250318_0819'
app_version <- function()'250318_0827'

View file

@ -254,7 +254,7 @@ import_file_server <- function(id,
parameters <- parameters[which(names(parameters) %in% rlang::fn_fmls_names(get(read_fns[[extension]])))]
# parameters <- parameters[which(names(parameters) %in% rlang::fn_fmls_names(read_fns[[extension]]))]
imported <- try(rlang::exec(read_fns[[extension]], !!!parameters), silent = TRUE)
code <- rlang::call2(read_fns[[extension]], !!!modifyList(parameters, list(file = input$file$name)), .ns = "freesearcheR")
code <- rlang::call2(read_fns[[extension]], !!!modifyList(parameters, list(file = input$file$name)), .ns = "FreesearchR")
if (inherits(imported, "try-error")) {
imported <- try(rlang::exec(rio::import, !!!parameters[1]), silent = TRUE)

24
R/launch_FreesearchR.R Normal file
View file

@ -0,0 +1,24 @@
#' Easily launch the FreesearchR app
#'
#' @description
#' All data.frames in the global environment will be accessible through the app.
#'
#' @param ... passed on to `shiny::runApp()`
#'
#' @returns shiny app
#' @export
#'
#' @examples
#' \dontrun{
#' data(mtcars)
#' shiny_FreesearchR(launch.browser = TRUE)
#' }
launch_FreesearchR <- function(...){
appDir <- system.file("apps", "FreesearchR", package = "FreesearchR")
if (appDir == "") {
stop("Could not find the app directory. Try re-installing `FreesearchR`.", call. = FALSE)
}
a <- shiny::runApp(appDir = paste0(appDir,"/app.R"), ...)
return(invisible(a))
}

View file

@ -15,15 +15,16 @@
#'
#' @examples
#' \dontrun{
#' mod <- lm(mpg ~ ., mtcars)
#' mod <- lm(mpg ~ ., default_parsing(mtcars))
#' p <- mod |>
#' gtsummary::tbl_regression() |>
#' plot(colour = "variable")
#' }
#'
plot.tbl_regression <- function(x,
# remove_header_rows = TRUE,
# remove_reference_rows = FALSE,
plot_ref = TRUE,
remove_header_rows = TRUE,
remove_reference_rows = FALSE,
...) {
# check_dots_empty()
gtsummary:::check_pkg_installed("ggstats")
@ -32,18 +33,22 @@ plot.tbl_regression <- function(x,
# gtsummary:::check_scalar_logical(remove_reference_rows)
df_coefs <- x$table_body
# if (isTRUE(remove_header_rows)) {
# df_coefs <- df_coefs |> dplyr::filter(!.data$header_row %in% TRUE)
# }
# if (isTRUE(remove_reference_rows)) {
# df_coefs <- df_coefs |> dplyr::filter(!.data$reference_row %in% TRUE)
# }
# browser()
browser()
if (isTRUE(remove_header_rows)) {
df_coefs <- df_coefs |> dplyr::filter(!header_row %in% TRUE)
}
if (isTRUE(remove_reference_rows)) {
df_coefs <- df_coefs |> dplyr::filter(!reference_row %in% TRUE)
}
# Removes redundant label
df_coefs$label[df_coefs$row_type == "label"] <- ""
df_coefs %>%
# Add estimate value to reference level
if (plot_ref == TRUE){
df_coefs[df_coefs$var_type == "categorical" & is.na(df_coefs$reference_row),"estimate"] <- if (x$inputs$exponentiate) 1 else 0}
df_coefs |>
ggstats::ggcoef_plot(exponentiate = x$inputs$exponentiate, ...)
}

View file

@ -81,7 +81,7 @@
#' #' @export
#' regression_table.default <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression") {
#' # Stripping custom class
#' class(x) <- class(x)[class(x) != "freesearcher_model"]
#' class(x) <- class(x)[class(x) != "freesearchr_model"]
#'
#' if (any(c(length(class(x)) != 1, class(x) != "lm"))) {
#' if (!"exponentiate" %in% names(args.list)) {
@ -110,7 +110,7 @@ regression_table <- function(x, ...) {
regression_table_create <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression") {
# Stripping custom class
class(x) <- class(x)[class(x) != "freesearcher_model"]
class(x) <- class(x)[class(x) != "freesearchr_model"]
if (any(c(length(class(x)) != 1, class(x) != "lm"))) {
if (!"exponentiate" %in% names(args.list)) {

View file

@ -1,37 +0,0 @@
#' Launch the freesearcheR tool locally
#'
#' @description
#' All data.frames in the global environment will be accessible through the app.
#'
#'
#' @param ... arguments passed on to `shiny::runApp()`
#'
#' @return shiny app
#' @export
#'
#' @examples
#' \dontrun{
#' data(mtcars)
#' shiny_freesearcheR(launch.browser = TRUE)
#' }
shiny_freesearcheR <- function(...) {
appDir <- system.file("apps", "freesearcheR", package = "freesearcheR")
if (appDir == "") {
stop("Could not find the app directory. Try re-installing `freesearcheR`.", call. = FALSE)
}
a <- shiny::runApp(appDir = paste0(appDir,"/app.R"), ...)
return(invisible(a))
}
#' Easily launch the freesearcheR app
#'
#' @param ... passed on to `shiny::runApp()`
#'
#' @returns shiny app
#' @export
#'
launch_freesearcheR <- function(...){
shiny_freesearcheR(...)
}

View file

@ -265,7 +265,7 @@ modal_update_factor <- function(id,
#'
#' @importFrom shinyWidgets WinBox wbOptions wbControls
#' @importFrom htmltools tagList
#' @rdname create-column
#' @rdname update-factor
winbox_update_factor <- function(id,
title = i18n("Update levels of a factor"),
options = shinyWidgets::wbOptions(),

View file

@ -1,35 +1,35 @@
# freesearcheR
# FreesearchR
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![rhub](https://github.com/agdamsbo/freesearcheR/actions/workflows/rhub.yaml/badge.svg)](https://github.com/agdamsbo/freesearcheR/actions/workflows/rhub.yaml)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14527429.svg)](https://doi.org/10.5281/zenodo.14527429)
[![freesearcheR](https://img.shields.io/badge/Shiny-shinyapps.io-blue?style=flat&labelColor=white&logo=RStudio&logoColor=blue)](https://agdamsbo.shinyapps.io/freesearcheR/)
[![rhub](https://github.com/agdamsbo/FreesearchR/actions/workflows/rhub.yaml/badge.svg)](https://github.com/agdamsbo/FreesearchR/actions/workflows/rhub.yaml)
[![FreesearchR](https://img.shields.io/badge/Shiny-shinyapps.io-blue?style=flat&labelColor=white&logo=RStudio&logoColor=blue)](https://agdamsbo.shinyapps.io/freesearcheR/)
<!-- badges: end -->
This package is the backbone of the ***freesearcheR***, a free and open-source browser based data exploration and analysis tool for clinicians and researchers with publication ready output.
This package is the backbone of the ***FreesearchR***, a free and open-source browser based data exploration and analysis tool for clinicians and researchers with publication ready output.
This package and the ***freesearcheR***-tool is part of a larger initiative to democratize health data analysis and remove barriers for clinicians to engage in health research.
This package and the ***FreesearchR***-tool is part of a larger initiative to democratize health data analysis and remove barriers for clinicians to engage in health research.
the ***freesearcheR***-tool is online and accessible here: [link to the app freely hosted on shinyapps.io](https://agdamsbo.shinyapps.io/freesearcheR/). All feedback is welcome and can be shared as a GitHub issue.
the ***FreesearchR***-tool is online and accessible here: [link to the app freely hosted on shinyapps.io](https://agdamsbo.shinyapps.io/FreesearchR/). All feedback is welcome and can be shared as a GitHub issue.
Initiatives for funding continued development of the tool and surrounding initiatives is ongoing.
## Install locally
The ***freesearcheR***-tool can also be launched locally. Any data.frame available in the global environment will be accessible from the interface.
The ***FreesearchR***-tool can also be launched locally. Any data.frame available in the global environment will be accessible from the interface.
```
require("devtools")
devtools::install_github("agdamsbo/freesearcheR")
library(freesearcheR)
devtools::install_github("agdamsbo/FreesearchR")
library(FreesearchR)
# By loading mtcars to the environment, it will be available
# in the interface like any other data.frame
data(mtcars)
shiny_freesearcheR()
launch_FreesearchR()
```
## Code of Conduct
Please note that the freesearcheR project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Please note that the ***FreesearchR*** project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

View file

@ -10,7 +10,7 @@
#### Current file: R//app_version.R
########
app_version <- function()'250318_0819'
app_version <- function()'250318_0827'
########
@ -7214,7 +7214,8 @@ ui_elements <- list(
),
shiny::br(),
shiny::br(),
shiny::tags$b("Code snippets:"),
shiny::h4("Code snippets"),
shiny::tags$p("Below are the code used to create the final data set. This can be saved for reproducibility. The code may not be 100 % correct, but kan be used for learning and example code to get started on coding yourself."),
shiny::verbatimTextOutput(outputId = "code_import"),
shiny::verbatimTextOutput(outputId = "code_data"),
shiny::verbatimTextOutput(outputId = "code_filter"),
@ -7535,11 +7536,6 @@ server <- function(input, output, session) {
)
})
# shiny::observeEvent(input$reset_confirm, {
# rv$data <- rv$data_original |> default_parsing()
# })
#########
######### Modifications
@ -7612,7 +7608,6 @@ server <- function(input, output, session) {
}
)
######### Subset, rename, reclass
updated_data <- update_variables_server(
@ -7626,8 +7621,6 @@ server <- function(input, output, session) {
rv$code$modify[[length(rv$code$modify) + 1]] <- attr(rv$data, "code")
})
######### Data filter
# IDEAFilter has the least cluttered UI, but might have a License issue
data_filter <- IDEAFilter::IDEAFilter("data_filter",
@ -7765,7 +7758,6 @@ server <- function(input, output, session) {
})
output$code_filter <- shiny::renderPrint({
shiny::req(rv$code$filter)
cat(rv$code$filter)
})

View file

@ -5,6 +5,6 @@ account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 13611288
bundleId: 9958862
bundleId: 9961770
url: https://agdamsbo.shinyapps.io/freesearcheR/
version: 1

23
man/launch_FreesearchR.Rd Normal file
View file

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/launch_FreesearchR.R
\name{launch_FreesearchR}
\alias{launch_FreesearchR}
\title{Easily launch the FreesearchR app}
\usage{
launch_FreesearchR(...)
}
\arguments{
\item{...}{passed on to \code{shiny::runApp()}}
}
\value{
shiny app
}
\description{
All data.frames in the global environment will be accessible through the app.
}
\examples{
\dontrun{
data(mtcars)
shiny_FreesearchR(launch.browser = TRUE)
}
}

View file

@ -1,17 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny_freesearcheR.R
\name{launch_freesearcheR}
\alias{launch_freesearcheR}
\title{Easily launch the freesearcheR app}
\usage{
launch_freesearcheR(...)
}
\arguments{
\item{...}{passed on to \code{shiny::runApp()}}
}
\value{
shiny app
}
\description{
Easily launch the freesearcheR app
}

View file

@ -4,7 +4,13 @@
\alias{plot.tbl_regression}
\title{Regression coef plot from gtsummary. Slightly modified to pass on arguments}
\usage{
\method{plot}{tbl_regression}(x, ...)
\method{plot}{tbl_regression}(
x,
plot_ref = TRUE,
remove_header_rows = TRUE,
remove_reference_rows = FALSE,
...
)
}
\arguments{
\item{x}{(\code{tbl_regression}, \code{tbl_uvregression})\cr
@ -20,7 +26,7 @@ Regression coef plot from gtsummary. Slightly modified to pass on arguments
}
\examples{
\dontrun{
mod <- lm(mpg ~ ., mtcars)
mod <- lm(mpg ~ ., default_parsing(mtcars))
p <- mod |>
gtsummary::tbl_regression() |>
plot(colour = "variable")

View file

@ -93,7 +93,7 @@ regression_table.list <- function(x, ...) {
#' @export
regression_table.default <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression") {
# Stripping custom class
class(x) <- class(x)[class(x) != "freesearcher_model"]
class(x) <- class(x)[class(x) != "freesearchr_model"]
if (any(c(length(class(x)) != 1, class(x) != "lm"))) {
if (!"exponentiate" \%in\% names(args.list)) {

View file

@ -1,23 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny_freesearcheR.R
\name{shiny_freesearcheR}
\alias{shiny_freesearcheR}
\title{Launch the freesearcheR tool locally}
\usage{
shiny_freesearcheR(...)
}
\arguments{
\item{...}{arguments passed on to \code{shiny::runApp()}}
}
\value{
shiny app
}
\description{
All data.frames in the global environment will be accessible through the app.
}
\examples{
\dontrun{
data(mtcars)
shiny_freesearcheR(launch.browser = TRUE)
}
}

View file

@ -5,6 +5,7 @@
\alias{update_factor_ui}
\alias{update_factor_server}
\alias{modal_update_factor}
\alias{winbox_update_factor}
\title{Module to Reorder the Levels of a Factor Variable}
\usage{
update_factor_ui(id)
@ -18,6 +19,13 @@ modal_update_factor(
size = "l",
footer = NULL
)
winbox_update_factor(
id,
title = i18n("Update levels of a factor"),
options = shinyWidgets::wbOptions(),
controls = shinyWidgets::wbControls()
)
}
\arguments{
\item{id}{Module ID.}
@ -39,6 +47,10 @@ pass \code{\link[bslib:bs_theme]{bslib::bs_theme()}} to the \code{theme} argumen
like \code{\link[shiny:fluidPage]{fluidPage()}}).}
\item{footer}{UI for footer. Use \code{NULL} for no footer.}
\item{options}{List of options, see \code{\link[shinyWidgets:wbOptions]{wbOptions()}}.}
\item{controls}{List of controls, see \code{\link[shinyWidgets:wbControls]{wbControls()}}.}
}
\value{
A \code{\link[shiny:reactive]{shiny::reactive()}} function returning the data.

View file

@ -1,8 +1,8 @@
---
title: "freesearcheR"
title: "FreesearchR"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{freesearcheR}
%\VignetteIndexEntry{FreesearchR}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
@ -11,9 +11,9 @@ vignette: >
knitr::opts_chunk$set(echo = TRUE,eval = FALSE)
```
# Getting started with ***freesearcheR***
# Getting started with ***FreesearchR***
Below is a simple walk-trough and basic instructions for the functions on the freesearcheR app.
Below is a simple walk-trough and basic instructions for the functions on the FreesearchR app.
## Launching
@ -21,13 +21,13 @@ The easiest way to get started is to launch [the hosted version of the app on sh
Additionally you have the option to run the app locally with access to any data in your current working environment.
To do this, open *R* (or RStudio or similar), and run the following code to install the latest version of ***freesearcheR*** and launch the app:
To do this, open *R* (or RStudio or similar), and run the following code to install the latest version of ***FreesearchR*** and launch the app:
```{r}
require("pak")
pak::pak("agdamsbo/freesearcheR")
library(freesearcheR)
freesearcheR::launch_freesearcheR()
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 available.