I think the issue was by ths following , Could it be that the reference to the variable $res disappears after the function call? Have you tried declaring it as a class variable, just like the $_resource variable?
hop of those help? Your problems have nothing to do with cut and more to do with the ifelse and apply functions. ifelse only returns a result that is the same length as the input so when you do
ifelse(T, cut(x, 3), T)
If ‘X’ is not an array but an object of a class with a non-null
‘dim’ value (such as a data frame), ‘apply’ attempts to coerce it
to an array via ‘as.matrix’ if it is two-dimensional (e.g., a data
frame) or via ‘as.array’.
it fixes the issue It's not a bug, but it's not exactly intuitive. 2018-03-31 minus one month is the 31st of February, which doesn't exist. PHP's implementation of strtotime deals with any "out of range" dates like these by moving into the next month by the relevant number of days, e.g.