Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 202012

Summing specific values in a row

$
0
0

I am currently working on the data displayed on the picture below and I would like to draw a cumulative plot of the number of animals specified by the data for each year.

enter image description here

For the first objective I am not really sure how I should proceed but I had the following plan: 1. Adding all the values for all the animal variables for the same year in different countries. So for example all the pigs, chickens, cattle etc... from France, England, Germany, etc... from 1961 up to 2014 (max) and from there I can make my cumulative plot.

But I am really not sure about how to get there. I managed to get all the row numbers for a specific year (e.g. all the rows containing the year 1961), but then I do not know to proceed. I could add all the numerical value in the row but it would include the year which I don't want. Also I would have to repeat the process from 1961 to 2014 that does not sound super elegant.

I would gladly accept any help if someone has an idea how to proceed :)

Thank you in advance !


Viewing all articles
Browse latest Browse all 202012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>