Browse code

if there is function in 'col', skip

Zuguang Gu authored on 14/09/2016 16:13:20
Showing 1 changed files

... ...
@@ -184,10 +184,10 @@ HeatmapAnnotation = function(df, name, col, na_col = "grey",
184 184
     	if(any(is.na(names(col)))) {
185 185
     		stop("`col` should be a named list.")
186 186
     	}
187
-    	if(any(sapply(col, function(x) is.null(names(x))))) {
187
+    	if(any(sapply(col, function(x) if(is.function(x)) FALSE else is.null(names(x))))) {
188 188
     		stop("elements in `col` should be named vectors.")
189 189
     	}
190
-    	if(any(sapply(col, function(x) any(is.na(names(x)))))) {
190
+    	if(any(sapply(col, function(x) if(is.function(x)) FALSE else any(is.na(names(x)))))) {
191 191
     		stop("elements in `col` should be named vectors.")
192 192
     	}
193 193
     }