Categories

Nov 14, 2019 in R Language
Q: nth observation in R language

1 Answer

Nov 14, 2019

The fonction nth() is complementary to first() and last(). You can access the nth observation within a group with the index to return.

For instance, you can filter only the second year that a team played.

# nth
data % > %
	group_by(teamID) % > %
	summarise(second_game = nth(yearID, 2)) % > %
	arrange(second_game)
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Nov 14, 2019 in R Language
Nov 14, 2019 in R Language
Nov 14, 2019 in R Language
...