Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- country <- c('A','A','A','B','B','C','C','C','C')
- year <- c(2010,2011,2015,2008,2009,2008,2009,2011,2015)
- score <- c(1,2,2,1,4,1,1,3,2)
- country year score
- 1 A 2010 1
- 2 A 2011 2
- 3 A 2015 2
- 4 B 2008 1
- 5 B 2009 4
- 6 C 2008 1
- 7 C 2009 1
- 8 C 2011 3
- 9 C 2015 2
- country year score change
- 1 A 2010 1 NA
- 2 A 2011 2 1
- 3 A 2015 2 0
- 4 B 2008 1 NA
- 5 B 2009 4 3
- 6 C 2008 1 NA
- 7 C 2009 1 0
- 8 C 2011 3 2
- 9 C 2015 2 -0.33
- country avg_change
- 1 A 0.5
- 2 B 3
- 3 C 0.55
Add Comment
Please, Sign In to add comment