title: R blearn - subgraph function error : nodes must be a vector of character strings
body: <p>What am I missing here? I already cleaned the workspace and restartet the session. Here is my the part of the code that seems to cause trouble. I am trying to average an bayesian networks arc strenghts from a strength object, then save all nodes of that averaged graph and then calculate the relevant nodes, saved as vector of character strings:</p>
  
  <pre><code>averaged = averaged.network (strength)
  nodes.averaged = unique(unlist(arcs(averaged)))
  relevant.nodes = nodes(averaged)[sapply(nodes.averaged, degree, object = averaged) &gt; 0]
  averagedNew = subgraph(averaged,relevant.nodes)
  </code></pre>
  
  <p>And then I get this Error:</p>
  
  <pre><code>Error in check.nodes(nodes, graph = x, max.nodes = length(x$nodes)) : 
    nodes must be a vector of character strings, the labels of the nodes.
  </code></pre>
  
  <p>This is my relevant.nodes:</p>
  
  <pre><code>[1] "V81"  "V97"  "V114" "V55"  "V93"  "V119" "V102" "V23"  "V24"  "V76"  "V67"  "V29"  "V33"  "V84"  "V89"  "V73" 
  [17] "V82"  "V71"  "V45"  "V7"   "V21"  "V109" "V5"   "V41"  "V65"  "V118" "V6"   "V20"  "V100" "V15"  "V59"  "V94" 
  [33] "V57"  NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA    
  [49] NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA    
  [65] NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA     NA    
  [81] NA     NA     NA     NA     NA     NA     NA     NA     NA     NA
  </code></pre>
  
  <p>When I checked the source code for the place, where this error message is thrown, I found the if-statement (<a href="https://github.com/vspinu/bnlearn/blob/master/R/utils-sanitization.R#L150" rel="nofollow noreferrer">Link</a>)</p>
  
  <pre><code>  # nodes must be a vector of character strings.
    if (!is(nodes, "character"))
      stop("nodes must be a vector of character strings, the labels of the nodes.")
  </code></pre>
  
  <p>and ran it:</p>
  
  <pre><code>(!is(relevant.nodes, "character"))
  </code></pre>
  
  <p>and the result is </p>
  
  <pre><code>[1] FALSE
  </code></pre>
  
  <p>Does anybody has an idea? I am rather new to R and still found myself to learn the difference between <code>=</code> and <code>&lt;-</code> just yesterday, so please don't be too harsh on me.</p>