Add possibilities for full table printinh

Change-Id: Ia232c0f73de40a4875431bedbb9cfdcc827bc089
diff --git a/R/common.R b/R/common.R
index f315150..83b8e5d 100644
--- a/R/common.R
+++ b/R/common.R
@@ -88,7 +88,7 @@
 
 }
 
-show_table <- function(df) {
+show_table <- function(df, max=50) {
   df %>%
     mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
     mutate(example=str_replace(example, ".*(\\W+\\w+\\W+\\w+\\W+<mark.*/mark>.*)", "\\1")) %>%
@@ -96,9 +96,30 @@
     rowwise() %>%
     mutate(Example=highliteSubstrings(example, wordsFromQuery(query))) %>%
     select(Collocate, Example, logDice, pmi, ll) %>%
-    head(50) %>%
+    head(max) %>%
     datatable(escape = F) %>%
     formatRound(columns=~logDice + pmi + ll, digits=2)
 }
 
+show__full_table <- function(df, max=5000) {
+  df %>%
+    mutate(Collocate=sprintf('<a href="%s">%s</a>', webUIRequestUrl, collocate)) %>%
+    mutate(example=str_replace(example, ".*(\\W+\\w+\\W+\\w+\\W+<mark.*/mark>.*)", "\\1")) %>%
+    mutate(example=str_replace(example, "(.*<mark.*/mark>\\W+\\w+\\W+\\w+).*", "\\1")) %>%
+    rowwise() %>%
+    mutate(Example=highliteSubstrings(example, wordsFromQuery(query))) %>%
+    mutate(url=paste0("=HYPERLINK('", webUIRequestUrl,"')")) %>%
+    select(Collocate, Example, url, logDice, pmi, ll) %>%
+    head(max) %>%
+    datatable(escape = F, extensions = 'Buttons', options = list(
+      paging = TRUE,
+      searching = TRUE,
+      fixedColumns = TRUE,
+      autoWidth = TRUE,
+      ordering = TRUE,
+      dom = 'tB',
+      buttons = c('copy', 'csv', 'excel')
+    )) %>%
+    formatRound(columns=~logDice + pmi + ll, digits=2)
+}