Skip to content
Back to formatted view

Raw Message

Message-ID: <fd47c8ab-7a7c-b478-07d7-777dc0a47291@syonic.eu>
Date: 2021-09-12T14:33:25Z
From: Leonard Mada
Subject: Evaluating lazily 'f<-' ?

How can I avoid evaluation?

right = function(x, val) {print("Right");};
padding = function(x) {print("Padding");};
df = data.frame(x=1:5, y = sample(1:5, 5));

### OK
'%=%' = function(x, val) {
 ??? x = substitute(x);
}
right(padding(df)) %=% 1; # but ugly

### Does NOT work
'right<-' = function(x, val) {
 ??? print("Already evaluated and also does not use 'val'");
 ??? x = substitute(x); # is evaluated before
}

right(padding(df)) = 1


Sincerely,


Leonard