Good morning all,
I am new to R and have searched long enough for an answer to a fairly basic problem ...
I have a dataset with various variables. My columns 6 to 50 are particle volumes and I would just like to have a new column (hence a new variable) that is the sum of all the other columns:
For example: imagine that I have 4 columns A B C and D:
A B C D
0 1 1 2
I would then like to have a column E which for this row indicates 4
Thanks a lot for your answer !
I don't understand what your 1:20 is and the ncol = 4?
I was thinking of using the mutate function to create a new variable which would be the sum of my columns.
Basically I have a basic data set called dataset1 with my variables 6 to 50 were volumes according to particle sizes, each variable has the mention LPM in its name. I just want to add all the volumes of each of the sizes to have only one variable and not 44
I was finally able to find out how to do it! I used mutate, thank you very much for your help, I was able to learn a lot about the different ways of using R:
if you are interested, here is how I proceeded: