Skip to contents

Demonstrates the custom converters by taking a Person from R, ageing them by one year in C++, and returning the Person back to R.

Usage

birthday(p)

Arguments

p

A list with a name (string) and an age (integer), converted to a Person by the custom Rcpp::as<Person>().

Value

A list with the same name and an age incremented by one, produced by the custom Rcpp::wrap() for Person.

Examples

birthday(list(name = "Jane", age = 30))
#> $name
#> [1] "Jane"
#> 
#> $age
#> [1] 31
#>