logo
pub trait Rinternals: Types + Conversions {
Show 63 methods fn is_null(&self) -> bool { ... } fn is_symbol(&self) -> bool { ... } fn is_logical(&self) -> bool { ... } fn is_real(&self) -> bool { ... } fn is_complex(&self) -> bool { ... } fn is_expressions(&self) -> bool { ... } fn is_environment(&self) -> bool { ... } fn is_promise(&self) -> bool { ... } fn is_string(&self) -> bool { ... } fn is_object(&self) -> bool { ... } fn is_s4(&self) -> bool { ... } fn is_external_pointer(&self) -> bool { ... } fn get_current_srcref(val: i32) -> Robj { ... } fn get_src_filename(&self) -> Robj { ... } fn as_character_vector(&self) -> Robj { ... } fn coerce_vector(&self, sexptype: u32) -> Robj { ... } fn pair_to_vector_list(&self) -> Robj { ... } fn vector_to_pair_list(&self) -> Robj { ... } fn as_character_factor(&self) -> Robj { ... } fn alloc_matrix(sexptype: SEXPTYPE, rows: i32, cols: i32) -> Robj { ... } fn duplicate(&self) -> Robj { ... } fn find_function<K: TryInto<Symbol, Error = Error>>(
        &self,
        key: K
    ) -> Result<Robj> { ... } fn find_var<K: TryInto<Symbol, Error = Error>>(
        &self,
        key: K
    ) -> Result<Robj> { ... } fn eval_promise(&self) -> Result<Robj> { ... } fn ncols(&self) -> usize { ... } fn nrows(&self) -> usize { ... } fn xlengthgets(&self, new_len: usize) -> Result<Robj> { ... } fn alloc_vector(sexptype: u32, len: usize) -> Robj { ... } fn conformable(a: &Robj, b: &Robj) -> bool { ... } fn is_array(&self) -> bool { ... } fn is_factor(&self) -> bool { ... } fn is_frame(&self) -> bool { ... } fn is_function(&self) -> bool { ... } fn is_integer(&self) -> bool { ... } fn is_language(&self) -> bool { ... } fn is_pairlist(&self) -> bool { ... } fn is_matrix(&self) -> bool { ... } fn is_list(&self) -> bool { ... } fn is_number(&self) -> bool { ... } fn is_primitive(&self) -> bool { ... } fn is_ts(&self) -> bool { ... } fn is_user_binop(&self) -> bool { ... } fn is_valid_string(&self) -> bool { ... } fn is_valid_string_f(&self) -> bool { ... } fn is_vector(&self) -> bool { ... } fn is_vector_atomic(&self) -> bool { ... } fn is_vector_list(&self) -> bool { ... } fn is_vectorizable(&self) -> bool { ... } fn is_raw(&self) -> bool { ... } fn is_char(&self) -> bool { ... } fn is_missing_arg(&self) -> bool { ... } fn is_unbound_value(&self) -> bool { ... } fn is_package_env(&self) -> bool { ... } fn package_env_name(&self) -> Robj { ... } fn is_namespace_env(&self) -> bool { ... } fn namespace_env_spec(&self) -> Robj { ... } fn is_altrep(&self) -> bool { ... } fn is_altinteger(&self) -> bool { ... } fn is_altreal(&self) -> bool { ... } fn is_altlogical(&self) -> bool { ... } fn is_altraw(&self) -> bool { ... } fn is_altstring(&self) -> bool { ... } fn deparse(&self) -> Result<String> { ... }
}
Expand description

The following impls wrap specific Rinternals.h functions.

Provided methods

Return true if this is the null object.

Return true if this is a symbol.

Return true if this is a boolean (logical) vector

Return true if this is a real (f64) vector.

Return true if this is a complex vector.

Return true if this is an expression.

Return true if this is an environment.

Return true if this is an environment.

Return true if this is a string.

Return true if this is an object (ie. has a class attribute).

Return true if this is a S4 object.

Return true if this is an expression.

Get the source ref.

Get the source filename.

Convert to a string vector.

Convert to vectors of many kinds.

Convert a pairlist (LISTSXP) to a vector list (VECSXP).

Convert a vector list (VECSXP) to a pair list (LISTSXP)

Convert a factor to a string vector.

Allocate a matrix object.

Do a deep copy of this object. Note that clone() only adds a reference.

Find a function in an environment ignoring other variables.

This evaulates promises if they are found.

See also global_function().

use extendr_api::prelude::*;
test! {
   let my_fun = base_env().find_function(sym!(ls)).unwrap();
   assert_eq!(my_fun.is_function(), true);

   // Note: this may crash on some versions of windows which don't support unwinding.
   // assert!(base_env().find_function(sym!(qwertyuiop)).is_none());
}

Find a variable in an environment.

See also global_var().

Note that many common variables and functions are contained in promises which must be evaluated and this function may throw an R error.

use extendr_api::prelude::*;
test! {
   let iris_dataframe = global_env()
       .find_var(sym!(iris)).unwrap().eval_promise().unwrap();
   assert_eq!(iris_dataframe.is_frame(), true);
   assert_eq!(iris_dataframe.len(), 5);

   // Note: this may crash on some versions of windows which don't support unwinding.
   //assert_eq!(global_env().find_var(sym!(imnotasymbol)), None);
}

If this object is a promise, evaluate it, otherwise return the object.

use extendr_api::prelude::*;
test! {
   let iris_promise = global_env().find_var(sym!(iris)).unwrap();
   let iris_dataframe = iris_promise.eval_promise().unwrap();
   assert_eq!(iris_dataframe.is_frame(), true);
}

Number of columns of a matrix

Number of rows of a matrix

Allocated an owned object of a certain type.

Return true if two arrays have identical dims.

Return true if this is an array.

Return true if this is factor.

Return true if this is a data frame.

Return true if this is a function or a primitive (CLOSXP, BUILTINSXP or SPECIALSXP)

Return true if this is an integer vector (INTSXP) but not a factor.

Return true if this is a language object (LANGSXP).

Return true if this is NILSXP or LISTSXP.

Return true if this is a matrix.

Return true if this is NILSXP or VECSXP.

Return true if this is INTSXP, LGLSXP or REALSXP but not a factor.

Return true if this is a primitive function BUILTINSXP, SPECIALSXP.

Return true if this is a time series vector (see tsp).

Return true if this is a user defined binop.

Return true if this is a valid string.

Return true if this is a valid string.

Return true if this is a vector.

Return true if this is an atomic vector.

Return true if this is a vector list.

Return true if this is can be made into a vector.

Return true if this is RAWSXP.

Return true if this is CHARSXP.

Returns true if this is an ALTREP object.

Returns true if this is an integer ALTREP object.

Returns true if this is an real ALTREP object.

Returns true if this is an logical ALTREP object.

Returns true if this is a raw ALTREP object.

Returns true if this is an integer ALTREP object.

Generate a text representation of this object.

Implementors

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.

find_var() etc.