OperatorR :has some famous gotchas:
a = c(1, 2, 3)
set.zero = function(n) a[1:n] <<- 0
set.zero(0)
I could just write a function that solves this, forcing 1:0to give an empty vector, but I would prefer if there were a sufficiently thin baseor CRAN package that provided such a function (ideally replacing :if it is not so dangerous). I tried to find him, but I can not find him.
Is there such a thing?
source
share