moving towards first working state

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-08 16:31:33 +01:00
parent 05b37b76b3
commit 4c0a19f09f
No known key found for this signature in database
14 changed files with 75 additions and 1695 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ dev/
.httr-oauth
.DS_Store
.quarto
app/rsconnect

View file

@ -11,6 +11,7 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Imports:
assertthat,
bslib,
dplyr,
glue,
gt,
@ -20,7 +21,8 @@ Imports:
openxlsx2,
quarto,
readODS,
readr
readr,
shiny
Suggests:
MASS,
styler

View file

@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand
export(argsstring2list)
export(baseline_table)
export(file_extension)
export(getfun)

View file

@ -5,6 +5,6 @@ account: agdamsbo
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 13276335
bundleId: 9334284
bundleId: 9334579
url: https://agdamsbo.shinyapps.io/webResearch/
version: 1

View file

@ -1,5 +1,23 @@
# project.aid::merge_scripts(list.files("R/",full.names = TRUE),dest = here::here("app/functions.R"))
source(here::here("app/functions.R"))
# source(here::here("functions.R"))
source("https://raw.githubusercongittent.com/agdamsbo/webResearch/refs/heads/main/app/functions.R")
library(readr)
library(MASS)
library(stats)
library(gt)
library(gtsummary)
library(openxlsx2)
library(haven)
library(readODS)
library(shiny)
library(bslib)
library(assertthat)
library(dplyr)
library(quarto)
library(here)
server <- function(input, output, session) {
v <- shiny::reactiveValues(
@ -108,7 +126,7 @@ server <- function(input, output, session) {
output$report <- downloadHandler(
filename = "analyses.html",
content = function(file) {
v$list |> write_quarto(file = file)
v$list |> write_quarto(file = file,qmd.file = "www/analyses.qmd")
}
)

View file

@ -104,16 +104,16 @@ ui <- bslib::page_sidebar(
),
actionButton("load", "Analyse", class = "btn-primary")
)
# ,
,
# Horizontal line ----
# tags$hr(),
# h4("Download results"),
#
# # Button
# downloadButton(outputId="report",
# label= "Download",
# icon = shiny::icon("download"))
# Horizontal line ----
tags$hr(),
h4("Download results"),
# Button
downloadButton(outputId="report",
label= "Download",
icon = shiny::icon("download"))
),
layout_columns(
cards[[1]]

View file

@ -7,22 +7,8 @@ params:
data.file: NA
---
<!-- ## Abstract -->
<!-- ### Background -->
<!-- ### Methods -->
<!-- ### Results -->
<!-- ### Conclusion -->
```{r setup}
web_data <- readRDS(file = params$data.file)
# readr::read_rds(file = here::here("data.Rds"))
library(gtsummary)
library(gt)
```
## Introduction

17
man/argsstring2list.Rd Normal file
View file

@ -0,0 +1,17 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{argsstring2list}
\alias{argsstring2list}
\title{Convert string of arguments to list of arguments}
\usage{
argsstring2list(string)
}
\arguments{
\item{string}{string to convert to list to use with do.call}
}
\value{
list
}
\description{
Idea from the answer: https://stackoverflow.com/a/62979238
}

View file

@ -6,11 +6,11 @@
\usage{
regression_model(
data,
outcome.str = "gear",
outcome.factor = TRUE,
outcome.str,
auto.mode = TRUE,
formula.str = NULL,
args.list = list(Hess = TRUE, method = "logistic"),
fun = "MASS::polr",
args.list = NULL,
fun = NULL,
vars = NULL
)
}
@ -19,7 +19,7 @@ regression_model(
\item{outcome.str}{Name of outcome variable. Character vector.}
\item{outcome.factor}{Factorize outcome variable. Logical.}
\item{auto.mode}{Make assumptions on function dependent on outcome data format.}
\item{formula.str}{Formula as string. Passed through 'glue::glue'. If given, 'outcome.str' and 'vars' are ignored. Optional.}
@ -37,11 +37,10 @@ Print a flexible baseline characteristics table
}
\examples{
gtsummary::trial |>
regression_model(outcome.str = "stage", fun = "MASS::polr")
regression_model(outcome.str = "age")
gtsummary::trial |>
regression_model(
outcome.str = "age",
outcome.factor = FALSE,
fun = "stats::lm",
formula.str = "{outcome.str}~.",
args.list = NULL

View file

@ -29,7 +29,6 @@ gtsummary::trial |>
gtsummary::trial |>
regression_model(
outcome.str = "age",
outcome.factor = FALSE,
fun = "stats::lm",
formula.str = "{outcome.str}~.",
args.list = NULL
@ -41,5 +40,5 @@ gtsummary::trial |>
fun = "stats::glm",
args.list = list(family = binomial(link = "logit"))
) |>
regression_table(args.list = list(exponentiate = TRUE))
regression_table()
}

View file

@ -7,7 +7,7 @@ project.aid::merge_scripts(list.files("R/",full.names = TRUE),dest = here::here(
shiny::runApp(appDir = here::here("app/"), launch.browser = TRUE)
project.aid::deploy_shiny(
files = c("server.R", "ui.R"),
path="app/",
account.name = "agdamsbo",
name.app = "webResearch",
name.token = "rsconnect_agdamsbo_token",

View file

@ -9,6 +9,21 @@
]
},
"Packages": {
"MASS": {
"Package": "MASS",
"Version": "7.3-61",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"grDevices",
"graphics",
"methods",
"stats",
"utils"
],
"Hash": "0cafd6f0500e5deba33be22c46bf6055"
},
"PKI": {
"Package": "PKI",
"Version": "0.1-14",

File diff suppressed because it is too large Load diff