Skip to content

Instantly share code, notes, and snippets.

@patperu
Last active October 2, 2016 08:49
Show Gist options
  • Save patperu/2c8f367416338d9f43ded2f8f86aa8ae to your computer and use it in GitHub Desktop.
Save patperu/2c8f367416338d9f43ded2f8f86aa8ae to your computer and use it in GitHub Desktop.
Statistiche Servizio ZTL
var count zdate
1  Numero utenti registrati ultimi 7 gg. 373 2016-10-02 10:49:13
2  Totale Pass richiesti 3462 2016-10-02 10:49:13
3   - online 2632 2016-10-02 10:49:13
4   - sportello 830 2016-10-02 10:49:13
5   - Cittadini 1705 2016-10-02 10:49:13
6   - Imprese 311 2016-10-02 10:49:13
7   - Liste bianche 1446 2016-10-02 10:49:13
8  Numero Pass richiesti ultimi 7 gg. 1482 2016-10-02 10:49:13
9  Numero transazioni di pagamento online 710 2016-10-02 10:49:13
library("rvest")
stat_Serv_ZTL <- function() {
zdate <- Sys.time()
res <- read_html("https://ztl.comune.palermo.it/ztl/jsp/home.jsp?modo=info&info=datiZTL.jsp")
p1 <- html_table(html_nodes(res, xpath = "//*[@id='colonna2']/div/div/table"), dec = ",")
p1 <- do.call("rbind", p1)
p1$X2 <- as.numeric(gsub("\\.", "", p1$X2))
p1 <- na.omit(p1)
names(p1) <- c("var", "count")
p1 <- data.frame(p1, zdate)
rownames(p1) <- NULL
p1
}
stat_Serv_ZTL()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment