I don't know how to do it in plyr but xx <- seq(1:300) nn <- trunc( length(xx)/4) yy <- xx[nn, ]
should come close. Have a look at ?ceiling or ?floor as an alternative to trunc() John Kane Kingston ON Canada > -----Original Message----- > From: shivibha...@ymail.com > Sent: Thu, 13 Aug 2015 03:14:38 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] Finding top 25% observations in Dplyr > > Hi All, I am working on a dataset baseball where i am grouping based on > one > var income in descending order. > Now i need to find the top 25% of the observations from the income group > for > which i used top_n (0.25) but it is not finding the desired. > > Can you please suggest. > > Baseball%>% > group_by(income)%>% top_n(0.25,income)%>% > arrange(desc(income)) > > > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Finding-top-25-observations-in-Dplyr-tp4711061.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ____________________________________________________________ Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords & protects your account. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.