rcpp_tapply_generator: Rcpp tapply Generator

Description Usage Arguments Details

Description

Use this function as a generator for your own tapply functions; that is, functions you would like to apply split over some grouping variable. Note that we restrict ourselves to the case where we return a scalar as output; rather than the more general output of tapply.

Usage

1
2
3
4
5
rcpp_tapply_generator(fun, includes = NULL, depends = NULL, inline = TRUE,
  returnType = "double", name = NULL, file = NULL, additional = NULL)

Rcpp_tapply_generator(fun, includes = NULL, depends = NULL, inline = TRUE,
  returnType = "double", name = NULL, file = NULL, additional = NULL)

Arguments

fun

A character string defining the C++ function. It must be in terms of a variable x.

includes

Other C++ libraries to include. For example, to include boost/math.hpp, you could pass c("<boost/math.hpp>"). Rcpp is included by default, unless RcppArmadillo is included as well (since Rcpp is included as part of the RcppArmadillo include)

depends

Other libraries to link to. Linking is done through Rcpp attributes.

returnType

The return type of your function; note that we require that the generator returns a scalar value of type double, int, or bool.

inline

boolean; mark this function as inline? This may or may not increase execution speed.

name

An internal name for the function.

file

A location to output the file. Defaults to a temporary file as generated by tempfile().

additional

Other C++ code you want to include; e.g. helper functions. This code will be inserted as-is above the code in fun.

Details

Note that we simplify differently than base R tapply: when simplify=TRUE, we call unlist on the output; hence, a named vector is returned.



Search within the Kmisc package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.