From 0caa3e6e98af3ac122b32cc63f22e8f5f5ca9110 Mon Sep 17 00:00:00 2001 From: Victor Navarro Date: Tue, 9 Apr 2024 21:28:15 +0100 Subject: [PATCH] fix on fixes for by data.table --- R/maps.R | 26 +++++++++++++------------- R/model_graphs.R | 2 +- R/model_parsers.R | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/maps.R b/R/maps.R index cf6e1e3..6a5fce6 100644 --- a/R/maps.R +++ b/R/maps.R @@ -2,14 +2,14 @@ formula_map <- function() { list( "HDI2020" = list( "associations" = "s2", - "activations" = "", - "pools" = "s2,type", + "activations" = c(), + "pools" = c("s2", "type"), "responses" = "s2" ), "HD2022" = list( "associations" = "s2", - "activations" = "", - "pools" = "s2,type", + "activations" = c(), + "pools" = c("s2", "type"), "responses" = "s2" ), "RW1972" = list( @@ -19,25 +19,25 @@ formula_map <- function() { "MAC1975" = list( "responses" = "s2", "associations" = "s2", - "associabilities" = "" + "associabilities" = c() ), "SM2007" = list( "activations" = "s2", "relative_activations" = "s2", "associations" = "s2", - "operator_switches" = "s2,comparison" + "operator_switches" = c("s2", "comparison") ), "PKH1982" = list( "responses" = "s2", - "associabilities" = "", - "associations" = "s2,type" + "associabilities" = c(), + "associations" = c("s2", "type") ), "ANCCR" = list( - "ij_eligibilities" = "", - "i_eligibilities" = "", - "i_base_rate" = "", + "ij_eligibilities" = c(), + "i_eligibilities" = c(), + "i_base_rate" = c(), "ij_base_rate" = "s2", - "representation_contingencies" = "s2,type", + "representation_contingencies" = c("s2", "type"), "net_contingencies" = "s2", "anccrs" = "s2", "causal_weights" = "s2", @@ -46,7 +46,7 @@ formula_map <- function() { "probabilities" = "s2" ), "TD" = list( - "associations" = "s2,t_bin", + "associations" = c("s2", "t_bin"), "eligibilities" = "t_bin", "values" = "t_bin" ), diff --git a/R/model_graphs.R b/R/model_graphs.R index ac16cef..93c53c6 100644 --- a/R/model_graphs.R +++ b/R/model_graphs.R @@ -31,7 +31,7 @@ calmr_model_graph <- function( # aggregate data x <- data.table::setDT(x)[trial == t, list("value" = mean(value)), - by = c("s1","s2") + by = c("s1", "s2") ] net <- ggnetwork::ggnetwork(network::as.network(x, loops = loops), layout = "circle", diff --git a/R/model_parsers.R b/R/model_parsers.R index c48ba75..4c593a2 100644 --- a/R/model_parsers.R +++ b/R/model_parsers.R @@ -256,7 +256,7 @@ # type is the type of data .aggregate_results_data_table <- function(dat, model, type) { value <- time <- NULL # local binding - common_terms <- c("group","phase","trial_type","trial","block_size","s1") + common_terms <- c("group", "phase", "trial_type", "trial", "block_size", "s1") fmap <- formula_map() form <- c(common_terms, fmap[[model]][[type]]) dat <- data.table::data.table(dat)