r - Using dplyr::filter, how can the output be limited to just first 500 rows? -
dplyr great , fast library.
using %.% operator enables powerful manipulation.
in first step, need limit output 500 rows max (for display purposes).
how can that?
par<-filter(pc,child_concept_gid==as.character(mcode)) %>% select(parent_concept_gid) what need like
filter(pc,condition,rows=500) is there direct way or nice workaround without making first step separate step (outside %>% "stream")
to limit output of filter, 1 can add together after filter function
top_n() credit goes commenter joran
solution
par<-filter(pc,child_concept_gid==as.character(mcode)) %>% top_n(500) %>% select(parent_concept_gid) r dplyr
No comments:
Post a Comment