Skip to content

Commit

Permalink
casting errors from factorFormula
Browse files Browse the repository at this point in the history
Addresses Issue #65
  • Loading branch information
nutterb committed Dec 11, 2015
1 parent 6c7d745 commit da62a10
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/factorFormula.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ factorFormula <- function(form, network){
nodeType = relabel_mat[, 3],
MoreArgs = list(network = network))

if (any(vapply(new_label, length, numeric(1)) == 0))
{
noFactors <- unique(names(new_label[vapply(new_label, length, numeric(1)) == 0]))
stop(paste0("The following nodes do not have factor levels defined ",
"in the 'factorLevels' element of the HydeNetwork object: ",
paste0(noFactors, collapse = ", ")))
}

form <- rewriteFormula(relabel, new_label, form)

as.formula(form)
Expand Down

0 comments on commit da62a10

Please sign in to comment.