I have a data table called e.table
that contains a column named Entity
and another named Equity
. One of the rows in the Entity
column is named total count
, and it sums all the Equity
values of the other rows. I have written this line that does this calculation:
e.table[e.table$Entity != "Total count", sum(e.table$Equity)]
and if I print it, it gives me what I want, but if I do this:
e.table <- e.table[e.table$Entity != "Total count", sum(e.table$Equity)]
or this:
e.table[, Equity :=vapply(Equity, e.talbe[e.table$Entity != "Total count", sum(e.table$Equity)]]
I don't get the updated value for Total count
.
What I actually want is to ask how I can apply this line of code into the table so that the table is updated with this new value of total count.