Skip to content

Commit 1149636

Browse files
committed
extra check to make sure no missing data are provided in biterms
1 parent e97006f commit 1149636

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/btm.R

+3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ BTM <- function(data, k = 5, alpha = 50/k, beta = 0.01, iter = 1000, window = 15
135135
biterms <- split(biterms, biterms$doc_id)
136136
}else{
137137
stopifnot(is.data.frame(biterms))
138+
if(anyNA(biterms)){
139+
stop("make sure there are no missing data in biterms")
140+
}
138141
if(!all(c("doc_id", "term1", "term2") %in% colnames(biterms))){
139142
stop("please provide in biterms a data.frame with at least 3 columns: doc_id, term1, term2, cooc - see the example in the help of BTM")
140143
}

0 commit comments

Comments
 (0)