mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
renaming
This commit is contained in:
parent
68c93d94e4
commit
04784a7a24
34 changed files with 121 additions and 137 deletions
|
|
@ -1 +1 @@
|
|||
app_version <- function()'250318_0819'
|
||||
app_version <- function()'250318_0827'
|
||||
|
|
|
|||
|
|
@ -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
24
R/launch_FreesearchR.R
Normal 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))
|
||||
}
|
||||
|
|
@ -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, ...)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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(...)
|
||||
}
|
||||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue