> d <- data.table(a,b,c)
> d[a=="f" & b>4, c:=-1*c]
Warning message:
In `[.data.table`(d, a == "f" & b > 4, `:=`(c, -1 * c)) :
Coerced double RHS to integer to match the type of the target column (column 3 named 'c'). The RHS values contain no fractions so would be more efficiently created as integer. Consider using R's 'L' postfix (typeof(0L) vs typeof(0)) to create constants as integer and avoid this warning. Wrapping the RHS with as.integer() will avoid this warning too but it's better if possible to create the RHS as integer in the first place so that the cost of the coercion can be avoided.
> d
a b c
1: t 1 11
2: t 2 12
3: f 3 13
4: t 4 14
5: f 5 -15
6: t 6 16
7: t 7 17
8: f 8 -18
9: t 9 19