From 36d325df5e4c04233b8046b13c05bb3c1676b0a2 Mon Sep 17 00:00:00 2001 From: jorainer Date: Fri, 23 Aug 2019 07:32:58 +0200 Subject: [PATCH] Ensure named character is returned by mapIds (issue #100) --- DESCRIPTION | 2 +- R/select-methods.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index af25def..20bc714 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ensembldb Type: Package Title: Utilities to create and use Ensembl-based annotation databases -Version: 2.9.4 +Version: 2.9.5 Authors@R: c(person(given = "Johannes", family = "Rainer", email = "johannes.rainer@eurac.edu", role = c("aut", "cre"), diff --git a/R/select-methods.R b/R/select-methods.R index ed44bcb..a975cef 100644 --- a/R/select-methods.R +++ b/R/select-methods.R @@ -343,7 +343,7 @@ setMethod("mapIds", "EnsDb", function(x, keys, column, keytype, ..., multiVals) vals <- split(res[, 2], f = factor(res[, 1], levels = unique(theNames))) vals <- unlist(vals[lengths(vals) == 1]) - if (length(vals)) vals else character() + if (length(vals)) vals else setNames(nm = character()) }, asNA = { ## Split the vector, set all those with multi mappings NA.