Skip to content

Instantly share code, notes, and snippets.

@lolek24
Created November 18, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lolek24/3ec99a3a8b661d2b6b377ab27a68e541 to your computer and use it in GitHub Desktop.
Save lolek24/3ec99a3a8b661d2b6b377ab27a68e541 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(urltools)
library(fs)
library(dplyr)
History_file <-fs::path(Sys.getenv("USERPROFILE"),
"AppData/Local/Google/Chrome/User Data/Default/History")
History_file
Database_file <- dplyr::src_sqlite(History_file)
df <- tbl(Database_file, 'urls') %>% collect() %>%
mutate(domain = urltools::domain(url))
df %>% count(domain) %>%top_n(30, n) %>%
mutate(domain = fct_reorder(domain, n)) %>%
ggplot() + geom_col(aes(domain, n)) + coord_flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment