RcppStringVectorExample: Example of using Rcpp StringVector (aka CharacterVector)

Description Details Author(s) References Examples

Description

The StringVector (aka CharacterVector class represents character vectors.

Details

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
        #include <Rcpp.h>
        using namespace Rcpp ;
        
        // [[Rcpp::export]]
        List StringVectorExample(StringVector orig) {
            StringVector vec(orig.size());	
        
            std::transform(orig.begin(), orig.end(), vec.begin(), 
        		   make_string_transformer(tolower));
        
            List result = List::create(
                Named( "result" )   = vec,
                Named( "original" ) = orig
            );
            return result ;
        }

    

Author(s)

Dominick Samperi wrote the initial versions of Rcpp (and RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain Francois have been extending Rcpp since 2009.

References

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

Examples

1
RcppStringVectorExample( c("Tick", "Tack", "Tock") )

RcppExamples documentation built on May 2, 2019, 4:46 p.m.