title: Rcpp function error Not compatible with STRSXP: [type=NULL]
body: <p>I'm very new to <code>Rcpp</code> and try to implement a simple thing, but I get an error and don't know what's wrong.
  I want a function which constructs <code>data.frame</code> from a <code>list</code>.
  My cpp file looks like this:</p>
  
  <pre><code>#include &lt;Rcpp.h&gt;
  using namespace Rcpp;
  
  // [[Rcpp::export]]
  DataFrame makeDF(List x) {
    NumericVector a = x["a"];
    NumericVector b = x["b"];
    NumericVector n = x["n"];
    const int n2 = n[0];
  
    NumericVector a2 = NumericVector(n2, a[0]);
    NumericVector b2 = NumericVector(n2, b[0]);
  
    DataFrame df = DataFrame::create(a2, b2);
  
    return df;
  }
  </code></pre>
  
  <p>Then in R I write:</p>
  
  <pre><code>library(Rcpp)
  sourceCpp("./cppcode/check_makeDF.cpp")
  # no errors here, it compiles OK
  x &lt;- list(a = 2.5, b = 1.1, n = 5)
  makeDF(x)
  # Error in makeDF(x) :Not compatible with STRSXP: [type=NULL].
  </code></pre>