I have a DataFrame df, which I group for instance like:
foo = by(df, [:param1, :param2], :res => mean)
Here, columns param1 and param2 store parameter values and column res stores result values. Foo shows the mean result values for each parameter combination.
I also have another column :flag which stores exit flags (integers) of each result. How can the example above be adapted to consider only values in which certain exit flags are set? e.g., something like:
foo = by(df, [:param1, :param2], :res => mean if(:flag .= 1 || :flag.=2) )
Thank you in advance.