Description Usage Arguments Details Value Examples
View source: R/extendr-wrappers.R
Demonstrates passing a double value back and forth between R and Rust, multiplies it by 10 in Rust to prove it works.
1 |
f |
A double (float) value to treat as an f64 in Rust |
The value passed to this function must be a double, which is the default
numeric type in R, or an NA_real_. The Rust function signature is
fn pass_single_float_fn(f: Option<f64>) -> Option<f64>
, with NA's being
handled as None
in Rust. The native R double is double-precision floating
point number, equivalent to Rust's f64
.
f * 10
1 2 3 | pass_single_double(5) # 50
pass_single_double(5.5) # 55
pass_single_double(NA_real_) # NA_real_
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.