Skip to content

Commit 696edce

Browse files
Fix missing node names bug
1 parent 0936ecd commit 696edce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/ccdrAlgorithm-main.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ ccdr_call <- function(data,
135135
alpha,
136136
verbose = FALSE
137137
){
138+
node_names <- names(data)
138139
# ### Allow users to input a data.frame, but kindly warn them about doing this
139140
# if(is.data.frame(data)){
140141
# warning(sparsebnUtils::alg_input_data_frame())
@@ -235,8 +236,8 @@ ccdr_call <- function(data,
235236

236237
### White/black lists
237238
# Be careful about handling various NULL cases
238-
if(!is.null(whitelist)) whitelist <- bwlist_check(whitelist, nodes)
239-
if(!is.null(blacklist)) blacklist <- bwlist_check(blacklist, nodes)
239+
if(!is.null(whitelist)) whitelist <- bwlist_check(whitelist, node_names)
240+
if(!is.null(blacklist)) blacklist <- bwlist_check(blacklist, node_names)
240241

241242
if(!is.null(whitelist) && !is.null(blacklist)){
242243
if(length(intersect(whitelist, blacklist)) > 0){
@@ -284,7 +285,7 @@ ccdr_call <- function(data,
284285
names(fit[[k]]$edges) <- names(data)
285286

286287
### Add node names to output
287-
fit[[k]] <- append(fit[[k]], list(names(data)), after = 1) # insert node names into second slot
288+
fit[[k]] <- append(fit[[k]], list(node_names), after = 1) # insert node names into second slot
288289
names(fit[[k]])[2] <- "nodes"
289290
}
290291

0 commit comments

Comments
 (0)