I have a set of column names in a list called list_1, now I want to calculate the mean for each column, but the thing is I do not want to include all the rows in the column when calculating the mean, i have another pre-defined variable that selects specific rows. How do I calculate the mean of the column by selecting the specified rows instead of stepping down through all the rows?
for example i want the mean to be calculated based on rows 1,3,4,5,9 on a specific column
dt << current data table;
for (p=1,p<=nitems(list_1), p++,
col = list_1
;
mean = col mean(dt :col );
)