I have a dataframe like
count sample type
1 DLF002 a
1 DLF002 a
1 DLF002 b
3 DLF001 a
3 DLF001 b
3 DLF001 b
and would like to make a summary given two factor (sample and type), so I would like to have a result like the following
count sample type
2 DLF002 a
1 DLF002 b
3 DLF001 a
6 DLF001 b
I have tried something like,
group_by(df, sample) %>% summarize(sx = sum(count)),
but this does not into account the "type"; I wonder how I can make this two level grouping, using dpylr