Skip to content

Instantly share code, notes, and snippets.

View lejarx's full-sized avatar
🌴
On vacation

lejarX lejarx

🌴
On vacation
View GitHub Profile
library(RemixAutoML)
library(data.table)
###########################################
# Prepare data for AutoTS()----
###########################################
# Load Walmart Data from Dropbox----
data <- data.table::fread("https://www.dropbox.com/s/2str3ek4f4cheqi/walmart_train.csv?dl=1")
@lejarx
lejarx / Batch convert Excel files to CSV.txt
Created September 15, 2019 12:58
VBA: Batch convert Excel files to CSV
Sub WorkbooksSaveAsCsvToFolder()
'UpdatebyExtendoffice20181031
Dim xObjWB As Workbook
Dim xObjWS As Worksheet
Dim xStrEFPath As String
Dim xStrEFFile As String
Dim xObjFD As FileDialog
Dim xObjSFD As FileDialog
Dim xStrSPath As String
Dim xStrCSVFName As String
@lejarx
lejarx / mapper_tutorial.py
Created August 21, 2019 15:08 — forked from ahadsheriff/mapper_tutorial.py
Crawl and scrape URLs to map a website
from bs4 import BeautifulSoup
import requests
import requests.exceptions
from urllib.parse import urlsplit
from urllib.parse import urlparse
from collections import deque
import re
url = "https://scrapethissite.com"
# a queue of urls to be crawled
nobs <- 4000
pb <- round(runif(n=1, min=0.1, max=0.8),1)
August <- rbinom(n=nobs, size=1, prob=pb)
pb <- round(runif(n=1, min=0.1, max=0.8),1)
September <- rbinom(n=nobs, size=1, prob=pb)
pb <- round(runif(n=1, min=0.1, max=0.8),1)
October <- rbinom(n=nobs, size=1, prob=pb)
pb <- round(runif(n=1, min=0.1, max=0.8),1)
November <- rbinom(n=nobs, size=1, prob=pb)
pb <- round(runif(n=1, min=0.1, max=0.8),1)
library(idbr) # devtools::install_github('walkerke/idbr')
library(ggplot2)
library(animation)
library(dplyr)
library(ggthemes)
idb_api_key("Put your Census API key here")
male <- idb1('CH', 2016:2050, sex = 'male') %>%
mutate(POP = POP * -1,
library(ggplot2);
library(grid);
data(iris)
x <- jitter(iris[,c('Sepal.Length')])
y <- jitter(iris[,c('Sepal.Width')])
z <- factor(iris[,c('Species')])
# The color blind palette without black:
"""
Demonstrates how to use the blocking scheduler to schedule a job that executes on 3 second
intervals.
"""
from datetime import datetime
import os
from apscheduler.schedulers.blocking import BlockingScheduler
@lejarx
lejarx / googleVis_with_knitr_and_RStudio.Rmd
Created January 6, 2016 06:12 — forked from mages/googleVis_with_knitr_and_RStudio.Rmd
Interactive reports in R with knitr and RStudio
My first examples with [***knitr***](http://yihui.name/knitr/)
-----------------------------------------
Let's include some simple R code:
```{r}
1+2
```
That worked.
Let's include a plot:
```{r fig.width=4, fig.height=4}
@lejarx
lejarx / mappingFlows.R
Created December 20, 2015 08:50 — forked from oscarperpinan/mappingFlows.R
An alternative implementation of "Mapping Flows in R" (http://spatial.ly/2015/03/mapping-flows/) using `data.table` and `lattice`
### DATA SECTION
library(data.table)
## Read data with 'data.table::fread'
input <- fread("wu03ew_v1.csv", select = 1:3)
setnames(input, 1:3, new = c("origin", "destination","total"))
## Coordinates
centroids <- fread("msoa_popweightedcentroids.csv")
## 'Code' is the key to be used in the joins