Skip to content

Instantly share code, notes, and snippets.

View yrochat's full-sized avatar
💭
Doing digital humanities

Yannick Rochat yrochat

💭
Doing digital humanities
View GitHub Profile
@yrochat
yrochat / allgames.R
Created January 21, 2016 23:25
Extract from the Mobygames db the number of video games per year
url <- "http://www.mobygames.com/browse/games/"
years <- as.character(1971:2015)
# library(plyr)
# l_ply(years, function(x) dir.create(str_c("allgames/", x, "/")))
library(rvest)
library(stringr)
@yrochat
yrochat / unicode.R
Last active February 9, 2016 22:36
library(rvest)
library(xml2)
library(stringr)
library(lubridate)
library(ggplot2)
unicode.html <- read_html("https://en.wikipedia.org/wiki/Unicode")
unicode.df <- html_table(xml_find_one(unicode.html, "//*[@id='mw-content-text']/table[4]"), fill = T)[-1,]
colnames(unicode.df)[c(6,7)] <- c("Total", "Notable additions")
@yrochat
yrochat / dist_eucl.csv
Created October 5, 2016 01:15
These are distances between articles (see my blog, post #20 about FIFA).
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 41 columns, instead of 35. in line 1.
"","puyo_17","puyo_16","puyo_15","puyo_14","puyo_13","puyo_12","puyo_11","puyo_10","puyo_09","puyo_08","puyo_07","puyo_06","puyo_05","puyo_04","puyo_03","akouel_02","anark_01","karaaj_17","karaaj_16","anagund_15","karaaj_14","anagund_13","rivaol_12","rivaol_11","rivaol_10","rivaol_09","rivaol_08","rivaol_07","rivaol_06","jihem_05","jihem_04","pilou_03","pilou_02","anonyme_01","mathieu_17","gianni_17","sharouda_17","absalon_17","de_caro_17","budry_carbo_17"
"puyo_17",0,60.1414998150196,62.8887907341205,58.4037670017954,60.522723005496,63.4428877022476,62.88083968905,59.2705660509498,62.2494979899437,62.1288982680363,64.55230437405,63.9296488336984,58.5491246732178,65.4140657657052,61.5060972587271,65.8634952003004,70.2780193232564,64.6065012208524,67.1192967781993,63.3798075099633,68.1909084849293,66.9253315270085,69.28924880528,69.2531587727231,69.0362223763728,65.6962708226274,65.7267069006199,64.7919748117003,63.7808748764079,66.873013989202,69.6778300465794,67.4907401055878,72.6498451478047,72.152616030189
@yrochat
yrochat / fifa.R
Last active March 25, 2019 11:02
The code for article #20 on my blog (about FIFA)
rm(list=ls())
library(readr) # importation
library(RTextTools) # classification de textes
library(textreuse) # plagiat
library(tm) # text mining
library(ggplot2) # visualisations
library(lsa) # latent semantic analysis
library(stringr) # manipulation de chaines de caractères
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 1.
"journal";"note";"auteur";"url";"annee";"texte"
"gamekult";"70";"puyo";"http://www.gamekult.com/jeux/test-fifa-17-SU3050706473t.html#ps4";"2017";"Si vous avez un tant soit peu suivi l'actualité de FIFA 17 depuis son annonce, vous savez déjà qu'il ne s'agit pas d'un FIFA +1 comme il en paraît chaque année. Pour ce millésime 2016, la simu d'EA Sports fait peau neuve en se dotant d'un nouveau moteur, le Frostbite cher à Battlefield, histoire de se mettre à niveau tout en bénéficiant des améliorations régulières apportées par les ingénieurs maison. Forcément, qui dit nouveau moteur sous-entend une liste considérable de changements et de petits ajustements, pour ne pas dire de concessions ; Konami avait d'ailleurs essuyé les plâtres il y a quelques années en osant le pari du Fox Engine, qui a longtemps tâtonné avant de parvenir à un compromis satisfaisant en 2016. FIFA 17 saura-t-il trouver la bonne formule dès le coup d'envoi ? \n Si l'on se place du point de vue dév, FIFA 17 tient du petit exploit. Même si le pr