From 790ce35a5ac8d5fe784b9e0471536ff6cb1a5d52 Mon Sep 17 00:00:00 2001 From: noerw Date: Thu, 17 Aug 2017 21:33:29 +0200 Subject: [PATCH] order phenomena by count --- R/phenomena.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/phenomena.R b/R/phenomena.R index e06c00a..1309e5e 100644 --- a/R/phenomena.R +++ b/R/phenomena.R @@ -28,7 +28,9 @@ osem_phenomena = function (boxes) UseMethod('osem_phenomena') #' names(phenoms[phenoms > 9]) #' osem_phenomena.sensebox = function (boxes) { - Reduce(`c`, boxes$phenomena) %>% # get all the row contents in a single vector + p = Reduce(`c`, boxes$phenomena) %>% # get all the row contents in a single vector table() %>% # get count for each phenomenon as.list() + + p[order(unlist(p), decreasing = T)] }