From 1e0ea3d17291781151d6130e86517ae6d35ec003 Mon Sep 17 00:00:00 2001 From: Thomas Guillerme Date: Thu, 19 Dec 2024 10:36:54 +0000 Subject: [PATCH] Update MCMCglmm.subsets.R --- R/MCMCglmm.subsets.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/MCMCglmm.subsets.R b/R/MCMCglmm.subsets.R index 5052ff90..a8822bcf 100755 --- a/R/MCMCglmm.subsets.R +++ b/R/MCMCglmm.subsets.R @@ -62,6 +62,9 @@ MCMCglmm.subsets <- function(data, posteriors, group, tree, rename.groups, set.l if(any(classifier)) { group_classifier <- data[,which(!numerics)[which(classifier)], drop = FALSE] } + if(ncol(group_classifier) == 0) { + stop("Could not find any classifier in the data in the format for MCMCglmm. Make sure a classifier is provided and in a factor format.") + } } else { cleaned_data <- data group_classifier <- matrix(1, nrow = nrow(data), ncol = 1, dimnames = list(rownames(data)))