Description Usage Arguments Details Value Examples
View source: R/extendr-wrappers.R
Demonstrates passing an integer vector back and forth between R and Rust, multiplies each element by 10 in Rust to prove it works.
1 |
n |
An integer vector to treat as an extendr_api::Int in Rust |
The vector passed to this function must be an integer (from as.integer(n)) or
an NA_integer_. The Rust function signature is
fn pass_multiple_integers(n: Int) -> Int
. In the current version of
extendr-api (0.2.0), NA's are implicitly converted to 0's, so if you need
NA handling you'll need to take care of that yourself for now.
n * 10
1 2 3 | pass_multiple_integers(as.integer(c(5, 7, 9))) # c(50, 70, 90)
pass_multiple_integers(as.integer(30)) # 300
pass_multiple_integers(NA_integer_) # 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.