title: How to determine the class of object stored in SEXP in Rcpp?
body: <pre><code>//[[Rcpp::export]]
  int Class_data(SEXP data) {
      /*
         return 0 if class of data is matrix
         else return -1 
      */
  }
  </code></pre>
  
  <p>How to determine the class of <code>data</code> in the above case? If <code>data</code> belongs to <code>matrix</code> class return 0 else return -1.</p>