From d8ab1ec92d109e2cd25deead16d11c9185c5eec3 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Wed, 7 Feb 2024 23:01:31 +0100 Subject: [PATCH] add third party registry setup + update join block to latest blockr --- R/demo-bms-blocks.R | 2 +- R/utils.R | 83 +++++++++++++++++++++++++++++++++++++++++++++ R/zzz.R | 6 ++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 R/zzz.R diff --git a/R/demo-bms-blocks.R b/R/demo-bms-blocks.R index 5c8ba13..7c818b1 100644 --- a/R/demo-bms-blocks.R +++ b/R/demo-bms-blocks.R @@ -374,7 +374,7 @@ demo_join_block <- function(data, ...) { data, y = "demo", type = "inner", - by_col = c("STUDYID", "USUBJID"), + by = c("STUDYID", "USUBJID"), ... ), data diff --git a/R/utils.R b/R/utils.R index c147d1b..0d01807 100644 --- a/R/utils.R +++ b/R/utils.R @@ -32,3 +32,86 @@ ui_fields_one_column <- function(x, ns, inputs_hidden) { div(cards, class = "mt-3") ) } + +register_blockr_extra_blocks <- function(pkg) { + + if (missing(pkg)) { + pkg <- pkg_name() + } + + register_blocks( + constructor = c( + plot_block, + ggiraph_block, + asfactor_block, + demo_data_block, + demo_join_block, + demo_arrange_block, + demo_group_by_block, + demo_filter_block_1, + demo_filter_block_2, + demo_summarize_block + ), + name = c( + "plot block", + "ggiraph block", + "asfactor block", + "demo data block", + "demo join block", + "demo arrange block", + "demo group by block", + "demo filter block 1", + "demo filter block 2", + "demo summarize block" + ), + description = c( + "Monolithic ggplot block", + "Monolithic ggiraph block", + "As factor mutate block", + "blockr.data preselected to lab data", + "Predefined join block for BMS demo", + "Predefined arrange block for BMS demo", + "Predefined group by block for BMS demo", + "Predefined filter block for BMS demo 1", + "Predefined filter block for BMS demo 2", + "Predefined summarize block for BMS demo" + ), + classes = list( + "plot_block", + c("ggiraph_block", "plot_block"), + c("asfactor_block", "transform_block"), + c("demo_dataset_block", "data_block"), + c("demo_join_block", "transform_block"), + c("demo_arrange_block", "transform_block"), + c("demo_group_by_block", "transform_block"), + c("demo_filter_block_1", "transform_block"), + c("demo_filter_block_2", "transform_block"), + c("demo_summarize_block", "transform_block") + ), + input = c( + "data.frame", + "data.frame", + "data.frame", + NA_character_, + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame" + ), + output = c( + "list", + "list", + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame", + "data.frame" + ), + package = pkg + ) +} \ No newline at end of file diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 0000000..218e30b --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,6 @@ +.onLoad <- function(libname, pkgname) { # nocov start + + register_blockr_extra_blocks(pkgname) + + invisible(NULL) +} # nocov end