Categories

Nov 14, 2019 in R Language
Q: Subsetting R Language

1 Answer

Nov 14, 2019

The function summarise() is compatible with subsetting.

## Subsetting + Median
data % > %
group_by(lgID) % > %
summarise(median_at_bat_league = median(AB), 
	#Compute the median without the zero 
	median_at_bat_league_no_zero = median(AB[AB > 0]))

Code Explanation

  • median_at_bat_league_no_zero = median(AB[AB > 0]): The variable AB contains lots of 0. You can compare the median of the at bat variable with and without 0.
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
...