# Difference operator?

Legacy User
Member Posts:

**0**Newbie
I have a table with N rows of data. Is there any operator that would convert it into a table of N-1 rows, where each row is a difference of two consecutive rows of the original table?

That is, input:

X Y

a b

c d

e f

Desired output:

X Y

c-a d-b

e-c f-d

If there is no such operator, can you treat this as a feature request?

Thank you!

That is, input:

X Y

a b

c d

e f

Desired output:

X Y

c-a d-b

e-c f-d

If there is no such operator, can you treat this as a feature request?

Thank you!

0

## Answers

347MavenAs far as I know, there is no such operator. Nevertheless, here is a workaround (thanks to RapidMiner for its litte operators which can be combined in powerful ways), tested with the iris-dataset which is also part of RM. Unfortunately you got to define your functions manually (in "FeatureGeneration"), hence this is only suitable for a smaller amount of attributes.

Note: To make this work in your situation, you must change the dataset-specific parameters (primarily the names of the attributes).

I hope this setup is self-explanatory, if not, feel free to ask.

hope this was helpful

Steffen

294RM Product Managementwow, what a process, I did not imagine this was even possible .. ... just joking!

Well, there is indeed actually no operator accomplishing this task. Although Ingo wrote a meta operator [tt]RelativeRegression[/tt] which allows to regress on the difference of label values, there is yet no general operator which allows to build differences of attribute values. Concerning time series models, this would certainly be a nice-to-have-operator. So, sometime somebody of us will certainly write such an operator... which by the way should not be all to complicated!

Regards,

Tobias

0NewbieIf you going to add this operator, can you make it with a choice of the function:

1. Differences.

2. Ratios

3. Ratios - 1

4. ln(ratios)

This seem to cover all typical cases.

Thank you for the great product and the fast response!

Victor

294RM Product ManagementRegards,

Tobias

18MavenI don´t know if it is too late. I can send you the sources if you want to extend to examples.

F.J. Cuberos

18Contributor IIi have the same problem. I need the difference of two rows.

Is there an operator who can do this? If not, how can i solve this problem?

1,869Unicornyou can use the Differentiate operator from the Series extension.

Best, Marius