• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in R Language by
Q:
Count function  in R language

1 Answer

0 votes
by

Count observations by group is always a good idea. With R, you can aggregate the the number of occurence with n().

For instance, the code below computes the number of years played by each player.

# count observations
data % > %
	group_by(playerID) % > %
	summarise(number_year = n()) % > %
	arrange(desc(number_year))

Related questions

0 votes
asked Nov 6, 2019 in R Language by MBarbieri
0 votes
asked Nov 14, 2019 in R Language by MBarbieri
...