From 4d5ed8bd19e997d336475e9378c96b83a475ac18 Mon Sep 17 00:00:00 2001 From: Brian Bolt Date: Wed, 27 Oct 2021 13:49:00 -0700 Subject: [PATCH] Fix for dose response failing due to data.table behavior change --- R/dose_response.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/dose_response.R b/R/dose_response.R index 11b42bd..2ce3b75 100644 --- a/R/dose_response.R +++ b/R/dose_response.R @@ -1336,7 +1336,7 @@ create_analysis_group_values_from_fitData <- function(analysisGroupId, curveName resultTypes <- copy(typeMap) resultTypes <- resultTypes[!is.na(units)] resultTypes <- resultTypes[ ls_kind %in% values$lsKind ] - resultTypes[!units %in% knownTypes, setValueUnits(typeKind=ls_kind, typeUnit=units),by=c("ls_kind","units")] + resultTypes[!units %in% knownTypes, if(.N > 0) setValueUnits(typeKind=ls_kind, typeUnit=units),by=c("ls_kind","units")] values[lsKind %in% typeMap[units=="response"]$ls_kind, unitKind := responseUnits] values[lsKind %in% typeMap[units=="dose"]$ls_kind, unitKind := doseUnits] @@ -1787,7 +1787,7 @@ add_clob_values_to_fit_data <- function(fitData) { resultTypes[ ,ls_kind:=gsub('/','',ls_kind)] resultTypes[ ,ls_kind:=tolower(ls_kind)] resultTypes <- resultTypes[ ls_kind %in% reportedValues$name ] - resultTypes[!units %in% knownTypes, setValueUnits(typeKind=ls_kind, typeUnit=units),by=c("ls_kind","units")] + resultTypes[!units %in% knownTypes, if(.N > 0) setValueUnits(typeKind=ls_kind, typeUnit=units),by=c("ls_kind","units")] reportedValues[name %in% tolower(modelFit[[1]]$typeMap[units=="response"]$ls_kind), units := responseUnits] reportedValues[name %in% tolower(modelFit[[1]]$typeMap[units=="dose"]$ls_kind), units := doseUnits]