This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w = readLines("https://raw.githubusercontent.com/layik/kurdi/master/corpus/kurdi_words.txt") | |
length(unique(w)) == length(w) | |
c = length(w) | |
c == 1668692 | |
ku_v = readLines("https://raw.githubusercontent.com/layik/kurdi/master/corpus/letters_lines.txt") | |
message("Kurdish alphabet: ", length(ku_v), " letters.") | |
letters_used = sapply(ku_v, function(x){ | |
length(grep(x, w)) | |
}) | |
head(letters_used) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stats19) | |
n = c("caNotINac","veNotINac","acNotINca", "acNotINve") | |
check = function(year = 2019) { | |
if(is.null(year) || is.na(year)) stop("Year is required") | |
ac = get_stats19(year = year, type = "ac") | |
ca = get_stats19(year = year, type = "ca") | |
ve = get_stats19(year = year, type = "ve") | |
# all(ca$accident_index %in% ac$accident_index) | |
# all(ve$accident_index %in% ac$accident_index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
r <- GET("localhost:27017") | |
if(r$status_code != "200") { | |
stop("Is Mongo running?") | |
} | |
devtools::load_all(".") | |
library(geocoder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update | |
# install on Ubuntu | |
apt-get install postgresql postgresql-contrib -y | |
# there is now a postgres user in /etc/passwd | |
# easy way to start it | |
service postgresql start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packages <- c("rtweet", "stringr", "ggplot2", "tmap", | |
"dplyr", "textdata", "tm", "tidytext", | |
"sentimentr", "wordcloud") | |
if (length(setdiff(packages, rownames(installed.packages()))) > 0) { | |
install.packages(setdiff(packages, rownames(installed.packages())),repos='http://cran.us.r-project.org') | |
} | |
lapply(packages, library, character.only = TRUE) | |
# ?? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get your trends from google trends | |
# single trend column | |
# ***remove the first two cells from the csv downloaded*** | |
csv = read.csv("~/Downloads/geoMap.csv", stringsAsFactors = FALSE) | |
head(csv) | |
names(csv) <- c("country", "count") | |
csv$count = as.numeric(csv$count) | |
csv = csv[complete.cases(csv), ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--Thanks to https://github.com/PaulLeCam/react-leaflet/blob/master/example/umd.html--> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Geoplumber front stand alone example</title> | |
<link | |
rel="stylesheet" | |
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Geoplumber exported React app</title> | |
</head> | |
<body> | |
<!-- We will put our React component inside this div. --> | |
<div id="geoplumber"></div> |