I have a data frame with two columns. First column contains categories such as "Syestem 1", "Syestem 2", and the second column has numbers that represent the correct/wrong answers. Correct means 1, and wrong means 0.
For example:
| SYSTEM | Q1 |
|---|---|
| S1 | 0 |
| S1 | 1 |
| S2 | 1 |
| S2 | 0 |
| S2 | 1 |
How to write R code to produce this table below
| System | Coorect answers | Wrong answers | Total answrs |
|---|---|---|---|
| S1 | 1 | 1 | 2 |
| S2 | 2 | 1 | 3 |
I used group by, filter, and if condition, but it seems not to be working. Please help me address this issue in R.