How to check whether a vector is LIFO/FIFO decreasing
Suppose I have a data.table where each row consists of two vectors: A 'pre-subtraction' vector. A 'post-subtraction' vector. The pre-subtraction is the left-half most column and the post- is the right-most columns, with the suffix "prm" at the end. For example: #Sample Data set.seed(2) fill = data.table(n=1:7) Tp=3 for(t in 1:Tp){ set(x = fill, j = paste0('v',t), value = sample(0:10,7)) } fill[1,paste0('v',3):=0] fill[5,paste0('v',2):=0] fill[5,paste0('v',3):=0] for(t in 1:Tp){ fill[,paste0('v',t,'prm'):=get(paste0('v',t))] } fill[1,paste0('v',1,'prm'):=0] fill[2,paste0('v',2,'prm'):=1] fill[5