From 34e861b977face6fe08e21314f40b559a0760eda Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Thu, 20 Jun 2024 13:11:19 +0200 Subject: [PATCH 1/3] load dataset.factors separately if dataset already exists --- R/descriptives.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/descriptives.R b/R/descriptives.R index 15e061f6..8f4abc99 100644 --- a/R/descriptives.R +++ b/R/descriptives.R @@ -33,6 +33,10 @@ DescriptivesInternal <- function(jaspResults, dataset, options) { dataset.factors <- temp[["dataset.factors"]] isNominalText <- temp[["isNominalText"]] } + else + { + dataset.factors <- .readDataSetToEnd(columns.as.factor = c(variables, splitName)) + } if (makeSplit && length(variables) > 0) { splitFactor <- dataset[[splitName]] From 942f945a6f0ec4ba761e95ecf20bb26a247918f1 Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Tue, 17 Sep 2024 16:55:49 +0200 Subject: [PATCH 2/3] move some of dons fixes around --- R/descriptives.R | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/R/descriptives.R b/R/descriptives.R index 8f4abc99..b200bbe4 100644 --- a/R/descriptives.R +++ b/R/descriptives.R @@ -15,12 +15,6 @@ # along with this program. If not, see . # -# This is a temporary fix -# TODO: remove it when R will solve this problem! -gettextf <- function(fmt, ..., domain = NULL) { - return(sprintf(gettext(fmt, domain = domain), ...)) -} - DescriptivesInternal <- function(jaspResults, dataset, options) { variables <- unlist(options$variables) splitName <- options$splitBy @@ -31,12 +25,16 @@ DescriptivesInternal <- function(jaspResults, dataset, options) { temp <- .descriptivesReadData(options, variables, splitName) dataset <- temp[["dataset"]] dataset.factors <- temp[["dataset.factors"]] - isNominalText <- temp[["isNominalText"]] } else { dataset.factors <- .readDataSetToEnd(columns.as.factor = c(variables, splitName)) } + + allMissing <- \(x) all(is.na(x)) + missingAllAsNumeric <- vapply(dataset, allMissing, FUN.VALUE = logical(1L)) + missingAllAsIs <- vapply(dataset.factors, allMissing, FUN.VALUE = logical(1L)) + isNominalText <- missingAllAsNumeric & !missingAllAsIs[names(missingAllAsNumeric)] if (makeSplit && length(variables) > 0) { splitFactor <- dataset[[splitName]] @@ -391,11 +389,8 @@ DescriptivesInternal <- function(jaspResults, dataset, options) { dataset.factors <- dataset allMissing <- \(x) all(is.na(x)) - missingAllAsNumeric <- vapply(dataset, allMissing, FUN.VALUE = logical(1L)) - missingAllAsIs <- vapply(dataset.factors, allMissing, FUN.VALUE = logical(1L)) - isNominalText <- missingAllAsNumeric & !missingAllAsIs[names(missingAllAsNumeric)] - return(list(dataset = dataset, dataset.factors = dataset.factors, isNominalText = isNominalText)) + return(list(dataset = dataset, dataset.factors = dataset.factors)) } .descriptivesDescriptivesTable <- function(dataset, dataset.factors, isNominalText, options, jaspResults, numberMissingSplitBy = 0) { From 05047049d6e315a4f528e65cae159c6310cc11ed Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Thu, 26 Sep 2024 13:44:15 +0200 Subject: [PATCH 3/3] disable preloading by default and enable for Descriptives --- inst/Description.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inst/Description.qml b/inst/Description.qml index 72725e25..756fff64 100644 --- a/inst/Description.qml +++ b/inst/Description.qml @@ -13,11 +13,13 @@ Description license : "GPL (>= 2)" icon : "analysis-descriptives.svg" hasWrappers : true + preloadData : false Analysis { - title: qsTr("Descriptive Statistics") - func: "Descriptives" + title: qsTr("Descriptive Statistics") + func: "Descriptives" + preloadData : true } Analysis