I want to find the average of given sets of numbers of varying length in R.
The data I have looks like this:
company_name marketcap date
A 100023 01-01-2000
A 100234 02-01-2000
A 108332 03-01-2000
A
.
.
A 112334 31-12-2000
B 24342 01-01-2000
B 25345 02-01-2000
.
.
There are hundred such companies. I want to calculate average value of marketcap for each company.
Output should look something like this (each marketcap value is an average rather than a set of numbers)
company_name marketcap
A 1023452
B 243425
.
.