From 543ff09754f18300508d505390f741391f314938 Mon Sep 17 00:00:00 2001 From: Nicholas Tierney Date: Tue, 14 Dec 2021 14:56:19 +0800 Subject: [PATCH] attempting to remove the Collate field (it is not successful so far) --- DESCRIPTION | 45 --------------------------------------------- R/aaa-.R | 32 ++++++++++++++++++++++++++++++++ R/inference.R | 10 ---------- R/utils.R | 24 ------------------------ 4 files changed, 32 insertions(+), 79 deletions(-) create mode 100644 R/aaa-.R diff --git a/DESCRIPTION b/DESCRIPTION index 910cbc6e..49b0355c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,51 +37,6 @@ SystemRequirements: Python (>= 2.7.0) with header files and shared library; Encoding: UTF-8 Depends: R (>= 3.1.0) -Collate: - 'package.R' - 'utils.R' - 'greta_mcmc_list.R' - 'tf_functions.R' - 'overloaded.R' - 'node_class.R' - 'node_types.R' - 'variable.R' - 'probability_distributions.R' - 'mixture.R' - 'joint.R' - 'unknowns_class.R' - 'greta_array_class.R' - 'as_data.R' - 'distribution.R' - 'operators.R' - 'functions.R' - 'transforms.R' - 'structures.R' - 'extract_replace_combine.R' - 'dag_class.R' - 'greta_model_class.R' - 'progress_bar.R' - 'inference_class.R' - 'samplers.R' - 'optimisers.R' - 'inference.R' - 'install_tensorflow.R' - 'calculate.R' - 'callbacks.R' - 'simulate.R' - 'chol2symm.R' - 'install_greta_deps.R' - 'conda_greta_env.R' - 'greta_stash.R' - 'greta_create_conda_env.R' - 'greta_install_miniconda.R' - 'greta_install_python_deps.R' - 'new_install_process.R' - 'reinstallers.R' - 'checkers.R' - 'test_if_forked_cluster.R' - 'zzz.R' - 'internals.R' Imports: abind, callr, diff --git a/R/aaa-.R b/R/aaa-.R new file mode 100644 index 00000000..d799fa01 --- /dev/null +++ b/R/aaa-.R @@ -0,0 +1,32 @@ +# create an object stash in greta's namespace, to return traces to the user when +# they abort a run +greta_stash <- new.env() +greta_stash$python_has_been_initialised <- FALSE +greta_stash$numerical_messages <- c( + "is not invertible", + "Cholesky decomposition was not successful" +) + +# create a named list +module <- function(..., sort = TRUE) { + dots <- list(...) + names <- names(dots) + + # guess names from call + cl <- match.call() + nm <- as.character(as.list(cl)[-1]) + + if (is.null(names)) { + names(dots) <- nm + } else { + blank_names <- names == "" + names[blank_names] <- nm[blank_names] + names(dots) <- names + } + + if (sort) { + dots <- dots[order(names(dots))] + } + + dots +} diff --git a/R/inference.R b/R/inference.R index 39d97a7a..020ca5fb 100644 --- a/R/inference.R +++ b/R/inference.R @@ -4,16 +4,6 @@ #' MCMC or likelihood/posterior optimisation. NULL - -# create an object stash in greta's namespace, to return traces to the user when -# they abort a run -greta_stash <- new.env() -greta_stash$python_has_been_initialised <- FALSE -greta_stash$numerical_messages <- c( - "is not invertible", - "Cholesky decomposition was not successful" -) - #' @rdname inference #' @export #' @importFrom stats rnorm runif diff --git a/R/utils.R b/R/utils.R index 4d910b1e..2725b3ba 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,29 +1,5 @@ # utility functions -# create a named list -module <- function(..., sort = TRUE) { - dots <- list(...) - names <- names(dots) - - # guess names from call - cl <- match.call() - nm <- as.character(as.list(cl)[-1]) - - if (is.null(names)) { - names(dots) <- nm - } else { - blank_names <- names == "" - names[blank_names] <- nm[blank_names] - names(dots) <- names - } - - if (sort) { - dots <- dots[order(names(dots))] - } - - dots -} - # find out whether the usr has conda installed and visible #' @importFrom reticulate conda_binary have_conda <- function() {