Skip to content

Instantly share code, notes, and snippets.

View nlddfn's full-sized avatar

Diego De Lazzari nlddfn

View GitHub Profile
@nlddfn
nlddfn / ShinyApp.R
Created August 21, 2016 07:15
Web-scraping-ShinyApp
library(shiny)
library(shinydashboard)
library(dplyr)
library(tidyr)
library(plotly)
library(DT)
library(rPython)
library(pdftools)
python.load("helperP3.py")
@nlddfn
nlddfn / helperP3.py
Created August 21, 2016 07:08
Web-scraping-helper
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 21:12:30 2016
@author: Diego
"""
from selenium import webdriver
#from bs4 import BeautifulSoup # For HTML parsing
from time import sleep # To prevent overwhelming the server between connections
from collections import Counter # Keep track of our term counts
@nlddfn
nlddfn / get_analytics.py
Last active November 24, 2016 02:00
Web-scraping-part2
def get_analytics():
"""
Created on Tue Aug 16 22:48:18 2016
@author: Diego
"""
import pandas as pd
from collections import Counter # Keep track of our term counts
from helperP3 import load_obj, skills_info
@nlddfn
nlddfn / glassdoorScrape.py
Last active July 4, 2018 12:10
Web-scraping-part1
# -*- coding: utf-8 -*-
def glassdoorScrape(get_short = False):
"""
Created on Tue Aug 16 22:41:30 2016
Scrape Glassdoor website using SELENIUM
@author: Diego De Lazzari
"""
@nlddfn
nlddfn / UI_basic_layout
Created August 7, 2016 22:13
Shiny_Migration_path_UI
shinyUI(
fluidPage(
titlePanel('Tracking migration paths from the Middle East'),
dashboardPage(
dashboardHeader(title = "Navigation"),
dashboardSidebar(
sidebarMenu(
menuItem("About", tabName = "about", icon = icon("info")),
menuItem("Balkan route", tabName = "destination", icon = icon("map")),
menuItem("Stats", tabName = "stats", icon = icon("bar-chart")),
@nlddfn
nlddfn / balkanRoute_Server.R
Created August 7, 2016 14:02
Shiny_Migration_path
# Create Map
output$map <- renderPlotly({
sel.data <- filter(balkanRoute.map, Date == input$slider.map)
# light grey boundaries
l <- list(color = toRGB("grey"), width = 0.5)
# specify map projection/options
g <- list(
@nlddfn
nlddfn / Observer_Server.R
Last active August 7, 2016 13:56
Shiny_MIgration_paths_Server.R
observe({
# data frames
if(input$whichData == 'Daily Arrivals'){
data_stat = balkanRoute}
else if(input$whichData == 'Gender'){
data_stat = dataGender2016}
else {data_stat = dataOrigin2016}
# Column indexes
if(input$whichData == 'Daily Arrivals'){