diff --git a/NAMESPACE b/NAMESPACE index 513c28e..20aa3d7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,11 +1,16 @@ # Generated by roxygen2: do not edit by hand S3method(cut,hms) +export(add_class_icon) +export(add_sparkline) export(argsstring2list) export(baseline_table) +export(create_overview_datagrid) export(custom_theme) export(cut_variable_server) export(cut_variable_ui) +export(data_summary_server) +export(data_summary_ui) export(default_format_arguments) export(default_parsing) export(factorize) @@ -14,21 +19,29 @@ export(format_writer) export(getfun) export(index_embed) export(is_any_class) +export(is_consecutive) export(is_datetime) +export(m_datafileUI) export(m_redcap_readServer) export(m_redcap_readUI) export(modal_cut_variable) export(modify_qmd) +export(overview_vars) export(read_input) export(regression_model) export(regression_model_uv) export(regression_table) +export(remove_na_attr) export(shiny_freesearcheR) export(specify_qmd_format) export(tbl_merge) +export(update_variables_server) +export(update_variables_ui) export(winbox_cut_variable) export(write_quarto) importFrom(classInt,classIntervals) +importFrom(data.table,as.data.table) +importFrom(data.table,data.table) importFrom(graphics,abline) importFrom(graphics,axis) importFrom(graphics,hist) @@ -40,6 +53,7 @@ importFrom(rlang,"%||%") importFrom(rlang,call2) importFrom(rlang,expr) importFrom(rlang,set_names) +importFrom(rlang,sym) importFrom(rlang,syms) importFrom(shiny,NS) importFrom(shiny,bindEvent) @@ -68,3 +82,4 @@ importFrom(toastui,datagrid) importFrom(toastui,datagridOutput2) importFrom(toastui,grid_colorbar) importFrom(toastui,renderDatagrid2) +importFrom(utils,type.convert) diff --git a/R/data-summary.R b/R/data-summary.R index 20f8e9f..3367b6d 100644 --- a/R/data-summary.R +++ b/R/data-summary.R @@ -126,7 +126,7 @@ add_sparkline <- function(grid, column = "vals", color.main = "#2a8484", color.s #' #' @param data vector #' -#' @returns +#' @returns logical #' @export #' #' @examples @@ -233,6 +233,10 @@ create_overview_datagrid <- function(data) { #' @export #' #' @examples +#' mtcars |> +#' overview_vars() |> +#' toastui::datagrid() |> +#' add_class_icon() add_class_icon <- function(grid, column = "class") { out <- toastui::grid_format( grid = grid, diff --git a/R/update-variables-ext.R b/R/update-variables-ext.R index 2407db7..6d78b97 100644 --- a/R/update-variables-ext.R +++ b/R/update-variables-ext.R @@ -386,8 +386,14 @@ add_var_toset <- function(data, var_name, default = "") { data[, datanames] } -#' @importFrom toastui datagrid grid_columns grid_format grid_style_column -#' grid_style_column grid_editor grid_editor_opts grid_selection_row +#' Modified from the datamods pacakge +#' +#' @param data data +#' +#' @param height height +#' @param selectionId selectionId +#' @param buttonId buttonId +#' #' @examples #' mtcars |> #' summary_vars() |> diff --git a/man/add_class_icon.Rd b/man/add_class_icon.Rd new file mode 100644 index 0000000..e21aeb3 --- /dev/null +++ b/man/add_class_icon.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{add_class_icon} +\alias{add_class_icon} +\title{Convert class grid column to icon} +\usage{ +add_class_icon(grid, column = "class") +} +\arguments{ +\item{grid}{grid} + +\item{column}{column} +} +\value{ +datagrid +} +\description{ +Convert class grid column to icon +} +\examples{ +mtcars |> + overview_vars() |> + toastui::datagrid() |> + add_class_icon() +} diff --git a/man/add_sparkline.Rd b/man/add_sparkline.Rd new file mode 100644 index 0000000..5439c35 --- /dev/null +++ b/man/add_sparkline.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{add_sparkline} +\alias{add_sparkline} +\title{Add sparkline to datagrid} +\usage{ +add_sparkline( + grid, + column = "vals", + color.main = "#2a8484", + color.sec = "#84EF84" +) +} +\arguments{ +\item{grid}{grid} + +\item{column}{clumn to transform} +} +\value{ +datagrid +} +\description{ +Add sparkline to datagrid +} +\examples{ +grid <- mtcars |> + default_parsing() |> + overview_vars() |> + toastui::datagrid() |> + add_sparkline() +grid +} diff --git a/man/create_overview_datagrid.Rd b/man/create_overview_datagrid.Rd new file mode 100644 index 0000000..d8a1731 --- /dev/null +++ b/man/create_overview_datagrid.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{create_overview_datagrid} +\alias{create_overview_datagrid} +\title{Create a data overview datagrid} +\usage{ +create_overview_datagrid(data) +} +\arguments{ +\item{data}{data} +} +\value{ +datagrid +} +\description{ +Create a data overview datagrid +} +\examples{ +mtcars |> + overview_vars() |> + create_overview_datagrid() +} diff --git a/man/data-summary.Rd b/man/data-summary.Rd new file mode 100644 index 0000000..7d0e8fb --- /dev/null +++ b/man/data-summary.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{data-summary} +\alias{data-summary} +\alias{data_summary_ui} +\alias{data_summary_server} +\title{Data summary module} +\usage{ +data_summary_ui(id) + +data_summary_server(id, data, color.main, color.sec) +} +\arguments{ +\item{id}{id} + +\item{data}{data} + +\item{color.main}{main color} + +\item{color.sec}{secondary color} +} +\value{ +Shiny ui module + +shiny server module +} +\description{ +Data summary module +} diff --git a/man/is_consecutive.Rd b/man/is_consecutive.Rd new file mode 100644 index 0000000..9d24026 --- /dev/null +++ b/man/is_consecutive.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{is_consecutive} +\alias{is_consecutive} +\title{Checks if elements in vector are equally spaced as indication of ID} +\usage{ +is_consecutive(data) +} +\arguments{ +\item{data}{vector} +} +\value{ +logical +} +\description{ +Checks if elements in vector are equally spaced as indication of ID +} +\examples{ +1:10 |> is_consecutive() +sample(1:100,40) |> is_consecutive() +} diff --git a/man/m_datafileUI.Rd b/man/m_datafileUI.Rd new file mode 100644 index 0000000..c10a254 --- /dev/null +++ b/man/m_datafileUI.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/file-import-module.R +\name{m_datafileUI} +\alias{m_datafileUI} +\title{Shiny UI module to load a data file} +\usage{ +m_datafileUI(id) +} +\arguments{ +\item{id}{id} +} +\value{ +shiny UI +} +\description{ +Shiny UI module to load a data file +} diff --git a/man/overview_vars.Rd b/man/overview_vars.Rd new file mode 100644 index 0000000..4412945 --- /dev/null +++ b/man/overview_vars.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-summary.R +\name{overview_vars} +\alias{overview_vars} +\title{Create a data overview data.frame ready for sparklines} +\usage{ +overview_vars(data) +} +\arguments{ +\item{data}{data} +} +\value{ +data.frame +} +\description{ +Create a data overview data.frame ready for sparklines +} +\examples{ +mtcars |> overview_vars() +} diff --git a/man/remove_na_attr.Rd b/man/remove_na_attr.Rd new file mode 100644 index 0000000..e5e01f8 --- /dev/null +++ b/man/remove_na_attr.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/helpers.R +\name{remove_na_attr} +\alias{remove_na_attr} +\title{Remove NA labels} +\usage{ +remove_na_attr(data, attr = "label") +} +\arguments{ +\item{data}{data} +} +\value{ +data.frame +} +\description{ +Remove NA labels +} +\examples{ +ds <- mtcars |> lapply(\(.x) REDCapCAST::set_attr(.x,label=NA,attr = "label")) +ds |> remove_na_attr() |> str() +} diff --git a/man/update-variables.Rd b/man/update-variables.Rd new file mode 100644 index 0000000..c3b2993 --- /dev/null +++ b/man/update-variables.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/update-variables-ext.R +\name{update-variables} +\alias{update-variables} +\alias{update_variables_ui} +\alias{update_variables_server} +\title{Select, rename and convert variables} +\usage{ +update_variables_ui(id, title = TRUE) + +update_variables_server( + id, + data, + height = NULL, + return_data_on_init = FALSE, + try_silent = FALSE +) +} +\arguments{ +\item{id}{Module's ID} + +\item{title}{Module's title, if \code{TRUE} use the default title, +use \code{NULL} for no title or a \code{shiny.tag} for a custom one.} + +\item{data}{a \code{data.frame} or a \code{reactive} function returning a \code{data.frame}.} + +\item{height}{Height for the table.} + +\item{return_data_on_init}{Return initial data when module is called.} + +\item{try_silent}{logical: should the report of error messages be suppressed?} +} +\value{ +A \code{\link[shiny:reactive]{shiny::reactive()}} function returning the updated data. +} +\description{ +Select, rename and convert variables +} diff --git a/man/update_variables_datagrid.Rd b/man/update_variables_datagrid.Rd new file mode 100644 index 0000000..b280e61 --- /dev/null +++ b/man/update_variables_datagrid.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/update-variables-ext.R +\name{update_variables_datagrid} +\alias{update_variables_datagrid} +\title{Modified from the datamods pacakge} +\usage{ +update_variables_datagrid( + data, + height = NULL, + selectionId = NULL, + buttonId = NULL +) +} +\arguments{ +\item{data}{data} + +\item{height}{height} + +\item{selectionId}{selectionId} + +\item{buttonId}{buttonId} +} +\description{ +Modified from the datamods pacakge +} +\examples{ +mtcars |> + summary_vars() |> + update_variables_datagrid() + +}