RcppExamples (version 0.1.8)

RcppStringVectorExample: Example of using Rcpp StringVector (aka CharacterVector)

Description

The StringVector (aka CharacterVector class represents character vectors.

Arguments

Details

The C++ code presented in the StringVectorExample.cpp file:


        #include <Rcpp.h>
        using namespace Rcpp ;

// [[Rcpp::export]] List StringVectorExample(const StringVector & orig) { StringVector vec(orig.size());

std::transform(orig.begin(), orig.end(), vec.begin(), make_string_transformer(tolower));

return List::create(Named("result") = vec, Named("original") = orig); }

References

Writing R Extensions, available at https://www.r-project.org.

Examples

Run this code
# NOT RUN {
  RcppStringVectorExample(c("Tick", "Tack", "Tock"))
# }

Run the code above in your browser using DataCamp Workspace