Skip to content

Instantly share code, notes, and snippets.

@kevinushey
Created February 8, 2013 00:57
Show Gist options
  • Save kevinushey/4735701 to your computer and use it in GitHub Desktop.
Save kevinushey/4735701 to your computer and use it in GitHub Desktop.
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
StringVector check( StringVector x ) {
Rcout << "The type of x is: " << ::TYPEOF( x ) << std::endl;
Rcout << "The type of x(0) is: " << ::TYPEOF( x(0) ) << std::endl;
Rcout << "The integer associated with STRSXPs is: " << STRSXP << std::endl;
Rcout << "The integer associated with CHARSXPs is: " << CHARSXP << std::endl;
Rcout << "Is x a string?: " << ::Rf_isString(x) << std::endl;
Rcout << "Is x(0) a string?: " << ::Rf_isString(x(0)) << std::endl;
return x;
}
/*** R
check( c("a", "b", "c") )
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment