Currently I have a data.table like this:
item dummyvar
4q7C0o 1
2BrKY63 1
3drUy6I 1
G5ALtO 1000
G5G859 1000
PAP589 2000
And using a defined function I find out that the rows where there is a significant change in the dummyvar
are in a numeric vector called imbalance = 4 6
. What I would like to do is to create a new column in my data table such that all the rows below the given numbers given by imbalance
are in a given class, for ex. something like this:
item dummyvar Class
4q7C0o 1 1
2BrKY63 1 1
3drUy6I 1 1
G5ALtO 1000 2
G5G859 1000 2
PAP589 2000 3