Skip to content

Commit 1abfeca

Browse files
committed
Update colocboost.R
add the default colnames of X if the colname of X is not provided
1 parent 1cceb76 commit 1abfeca

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

R/colocboost.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,14 @@ colocboost <- function(X = NULL, Y = NULL, # individual data
224224
warning("Error: X matrices do not have the same number of variables. Provide variable names to the colnames of X matrix.")
225225
return(NULL)
226226
}
227+
} else {
228+
# --- check if there is only one X, default variable names as X_1, ..., X_p
229+
X <- lapply(X, function(xx){
230+
if (is.null(colnames(xx))){ colnames(xx) <- paste0("X_", 1:ncol(xx)) }
231+
return(xx)
232+
})
227233
}
234+
228235
keep.variable.individual <- lapply(X, colnames)
229236
if (!is.list(X) & !is.list(Y)){
230237
warning("Error: Input X and Y must be the list containing genotype matrics and all phenotype vectors!")

0 commit comments

Comments
 (0)