Skip to content

Instantly share code, notes, and snippets.

@flovv
flovv / Content_Evaluation.r
Last active September 25, 2020 05:10
Small script to scrape r-bloggers social data by author
require(httr)
require(stringr)
require(rvest)
getNumberOfPages <- function(url){
rb <- read_html(url)
str <- rb %>%
@flovv
flovv / scrapeGoogleImages.js
Last active September 25, 2020 05:10
scrapeGoogleImages_file1
var url ='https://www.google.de/search?q=Yahoo+logo&source=lnms&tbm=isch&sa=X';
var page = new WebPage()
var fs = require('fs');
var vWidth = 1080;
var vHeight = 1920;
page.viewportSize = {
width: vWidth ,
height: vHeight
@flovv
flovv / DeepLearningPartOne.R
Created June 18, 2017 16:02
Deep Learning for Brand Logo detection in R
########## data proprocessing!
## download the file set from here: http://image.ntua.gr/iva/datasets/flickr_logos/
## extract image to a folder flickrData
### copy files in the right directories
options(stringsAsFactors = F)
df <- read.csv("flickrData/flickr_logos_27_dataset_query_set_annotation.txt", sep="\t")
@flovv
flovv / weighted.SummarySE
Created April 11, 2017 06:58
Showing weighted.summarySE function to aggregate weighted means with standard errors
require(ggplot2)
require(ggthemes)
require(plyr)
require(stringr)
require(Rmisc)
require(lubridate)
require(popbio) #betaval - to create random beta variables
#### Experiment setting
rnorm2 <- function(n,mean,sd) { mean+sd*scale(rnorm(n)) }
@flovv
flovv / optimization-lpsolve.R
Last active February 16, 2017 15:56
lpsolve - optimization of a fantasy football team
require(ggplot2)
require(ggthemes)
require(plyr)
require(stringr)
library(lpSolve)
out <- read.csv("https://raw.githubusercontent.com/flovv/flovv.github.io/master/_Rmd/data/com.csv", sep="|")
@flovv
flovv / MachineLearningImprovement.R
Created December 29, 2016 13:58
appendix to a blog post
require(ggplot2)
require(ggthemes)
require(rvest)
require(plyr)
url <- "http://rodrigob.github.io/are_we_there_yet/build/classification_datasets_results.html"
ml <- read_html(url)
tabs <- ml %>% html_nodes(xpath='//*[@class="table table-striped"]') %>% html_table()
df <- tabs[[1]]
@flovv
flovv / unicorn_ggplot_theme
Created November 27, 2016 17:28
a unicorn ggplot theme with example charts
require(ggplot2)
require(ggthemes)
require(plyr)
require(reshape2)
library(grid)
require(lubridate)
require(stringr)
options(stringsAsFactors = FALSE)
@flovv
flovv / digitalTransformation.R
Created October 25, 2016 05:31
gather data from 3 news APIs
#devtools::install_github("ropengov/rtimes")
#devtools::install_github("chgrl/diezeit")
library(rtimes)
library(diezeit)
require(plyr)
require(lubridate)
require(ggthemes)
require(ggplot2)
@flovv
flovv / Youtube_Stats.R
Last active September 25, 2020 05:10
Gather Youtube Stats for the US election
#devtools::install_github("soodoku/tuber", build_vignettes = TRUE)
require(tuber)
require(ggplot2)
require(gtools)
require(ggthemes)
options(stringsAsFactors = FALSE)
require(plyr)
## login credentials: console.google.com
@flovv
flovv / AirBnB_Demographics.R
Created July 3, 2016 15:30
Analyzing AirBnB demographics
## gather data:
require(Roxford)
images <- list.files("sample bilder/")
facekey = "API KEY"
for(i in images[1:200]){
dff <- getFaceResponse(paste0("sample bilder/",i), facekey)