Skip to content

Instantly share code, notes, and snippets.

@pbiecek
Created April 15, 2015 10:19
Show Gist options
  • Select an option

  • Save pbiecek/78a4d74d1b41d76d26dc to your computer and use it in GitHub Desktop.

Select an option

Save pbiecek/78a4d74d1b41d76d26dc to your computer and use it in GitHub Desktop.
auta2012 %>%
filter(Kolor!="") %>%
group_by(Kolor, Rok.produkcji) %>%
summarise(median_KM = quantile(KM, 0.9, na.rm=T),
count = n()) %>%
filter(count>20) %>%
group_by(Rok.produkcji) %>%
arrange(-median_KM) %>%
slice(1) %>%
group_by() %>%
arrange(-Rok.produkcji) %>%
as.data.frame()
## Kolor Rok.produkcji median_KM count
## 1 czarny 2012 396.0 22
## 2 bialy-metallic 2011 317.2 411
## 3 szary 2010 435.0 58
## 4 bialy-metallic 2009 290.8 139
## 5 szary 2008 321.8 59
## 6 szary 2007 314.5 50
## 7 bialy-metallic 2006 279.0 73
## 8 bialy-metallic 2005 311.4 68
## 9 czarny 2004 232.7 343
## 10 czarny 2003 220.0 299
## 11 bezowy-metallic 2002 199.0 51
## 12 bezowy-metallic 2001 240.4 43
## 13 czarny-metallic 2000 194.7 1058
## 14 brezowy-metallic 1999 214.4 39
## 15 brezowy-metallic 1998 203.0 29
## 16 grafitowy-metallic 1997 194.4 156
## 17 czarny-metallic 1996 187.5 251
## 18 czarny-metallic 1995 218.0 188
## 19 fioletowy-metallic 1994 220.0 27
## 20 srebrny-metallic 1993 231.0 88
## 21 czarny-metallic 1992 217.3 102
## 22 czarny-metallic 1991 218.2 64
## 23 czarny-metallic 1990 310.0 44
## 24 czarny-metallic 1989 203.4 21
## 25 czarny 1988 246.0 23
## 26 bialy 1987 136.0 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment