Last active
February 5, 2017 05:54
-
-
Save artemklevtsov/28d1bffbec6f4feff20edc7375c99266 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [[Rcpp::plugins("cpp11")]] | |
#include <Rcpp.h> | |
#include <functional> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
std::vector<size_t> hash(const std::vector<std::string>& x) { | |
std::vector<size_t> res(x.size()); | |
std::transform(x.begin(), x.end(), res.begin(), std::hash<std::string>()); | |
return res; | |
} | |
/*** R | |
hash(c("string", "string", "other string", "sadasd")) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment