Created
April 4, 2017 11:00
-
-
Save nathan-russell/a8395e1ca8b9ea4a57b5dedb95b833d2 to your computer and use it in GitHub Desktop.
This file contains 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
#include <Rcpp.h> | |
using namespace Rcpp; | |
// [[Rcpp::export]] | |
CharacterVector ModifyString(CharacterVector x) | |
{ | |
String ref = x[0]; | |
ref = "Modified"; | |
return x; | |
} | |
// [[Rcpp::export]] | |
CharacterVector ModifyProxy(CharacterVector x) | |
{ | |
internal::string_proxy<STRSXP> ref = x[0]; | |
ref = "Modified"; | |
return x; | |
} | |
/*** R | |
x <- letters[1:5] | |
ModifyString(x) | |
# [1] "a" "b" "c" "d" "e" | |
ModifyProxy(x) | |
# [1] "Modified" "b" "c" "d" "e" | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment