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

How to group consecutive rows having same event and find average?

$
0
0
Value <- c(2,3,5,2,5,8,17,3,5)
Event <- c(1,1,2,2,2,1,1,2,2)

group <- data.frame(pt=Value, Event=Event)

I have data like above and I would like to group events in a way that would result into following.

Event Value
1     2.5
2     4
1     12.5
2     4

Thank you in advance.


Viewing all articles
Browse latest Browse all 202004

Trending Articles



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