Yes, you can manipulate the language object, and replace the the 1:10
with its own 5. element, and then call eval on the modified
expression. This can be simple if you know the structure of the
expression well, and difficult otherwise.
It goes like this:
SEXP lang_test(SEXP expr, SEXP idx, SEXP i
You may be trying to do something similar to hutilscpp::which_first(x < 5)
which does most of its work at the R level. That is notice an expression is
of the form lhs operator rhs then evaluate each element of lhs separately
On Fri, 27 Sep 2019 at 8:35 pm, Morgan Morgan
wrote:
> Hi,
>
> I am
Hi,
I am wondering if the below is possible?
Let's assume I have the following expression:
1:10 < 5
Is there a way at the R C API level to only evaluate the 5th element (i.e 5
< 5) instead of evaluating the whole expression and then select the 5th
element in the logical vector?
Thank you
Best r