Skip to content
Prev 389124 / 398506 Next

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