I am trying to add two specific values in R. I am new to R and so far I have used colSums and it does give me the right values. However, I was wondering if there was a way to add specific cells and then add as them as row to the dataframe. In this case, I would like to add the last two columns.
Here's sample data:
| col1 | col2 | col3 |
|---|---|---|
| 3 | 7 | a |
| 2 | 4 | b |
| 1 | 5 | c |
Desired output:
| col1 | col2 | col3 |
|---|---|---|
| 3 | 7 | a |
| 3 | 9 | b&c |