title: Error in file(con, "w") : cannot open the connection [Using R-Studio to plot interactive bar graphs using rCharts, knitr]
body: <p>I am getting an error when I am trying to run the code below in R-Studio 3.3.2 on a Mac (OS Sierra)</p>
  
  <pre><code>devtools::install_github('ramnathv/rCharts')
  install.packages("knitr")
  require(rCharts)
  require(knitr)
  
  haireye &lt;- as.data.frame(HairEyeColor)
  n1 &lt;- nPlot(Freq ~ Hair, group = 'Eye', type = 'multiBarChart',
          data = subset(haireye, Sex == 'Male')
          )
  
  n1$save('fig/n1.html', cdn = TRUE)
  cat('&lt;iframe src="fig/n1.html" width= 100%, height=600&lt;/iframe&gt;')
  </code></pre>
  
  <p>Pls see output below:</p>
  
  <blockquote>
    <p><strong>Error in file(con, "w") : cannot open the connection</strong>
    <em>In addition: Warning message: In file(con, "w") :   cannot open file 'fig/n1.html': No such file or directory</em></p>
  </blockquote>
  
  <p>But I am able to generate the reqd bar graph in the viewer when I use: </p>
  
  <pre><code>n1$show(cdn = TRUE)
  </code></pre>
  
  <p>in lieu of <code>n1$save('fig/n1.html', cdn = TRUE)</code></p>
  
  <p>To take care of write permission issues (if any), I also tried including the line below, altering the WD path wherever necessary.</p>
  
  <pre><code>knitr::knit2html('Users/documents/n1.html')
  </code></pre>
  
  <p>But it did not help. I see the n1.html file created but it only opens an empty browser. </p>
  
  <p>Any help to resolve this is appreciated. </p>
  
  <p><strong>Best,
  S</strong></p>