Multiple column lag

Hi,

I have a time series data with columns of consumption of different appliance (eg, TV, Electric kettle, washing machine, and so on ) I would like to lag each of the columns by 3 steps.

I am expecting somthing like this

for house 1:

time | TV | TV(-1) | TV(-2) | TV(-3) | Kettle | Kettle(-1) | Kettle(-2) | Kettle(-3) | Washing Mach| Washing Mach(-1)| and so on. Say i have different appliance in each house. so whatever appliance i have, everything should be lagged by 3 steps. i could use column splitter to feed the appliance into a column list loop, -> lag column -> loop end(column append). but i am not getting the end result. the loop stops when it lags 3 steps for 1st iteration.

Can anyone suggest a simple loop solution for this ?

Thank you,

Hi,

you need to use a column loop. (See a general example here: https://www.knime.org/nodeguide/control-structures/loops/looping-over-all-columns-and-manipulation-of-each)

You only need to exchange the Math Formula with a Lag node.

Best, Iris 

Hi,

a bit late to the party but maybe the OP is still looking for help...

Since we ran into this challenge repeatedly we came up with two general ways of dealing with it.

Solution 1: As suggested by Iris, this simply uses a column list loop and column append loop end.

Solution 2: Builds on collection columns. A bit more complex but helpful if you want to calculate a moderate number of lags for a large number of columns.

Find a simple example KNWF attached.

Best, Johannes