Browse Source

Added uniq function to work as UNIX uniq

static
Maxime Wack 6 years ago
parent
commit
92a2f4f575
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      app.R

+ 14
- 0
app.R View File

@@ -5,6 +5,20 @@ library(RSQLite)
library(stringr)
library(plotly)

uniq <- function(df, ...)
{
eval(substitute(alist(...))) %>%
map_chr(as.character) %>%
intersect(names(df)) %>%
map(~rle(df[[.x]] %>% c) %>%
.$lengths %>%
cumsum) %>%
reduce(union) %>%
sort -> columns


df[columns,]
}
dbConnect(SQLite(), "ecn.db") -> db

# Index villes et spés ----


Loading…
Cancel
Save