- Uber Movememt Data - https://movement.uber.com/
- NYC trip record - http://www.nyc.gov/html/tlc/html/about/trip_record_data.shtml
This file contains hidden or 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(rvest) | |
col_names <- c("Constituency","Const. No.", "Leading Candidate", | |
"Leading Party" ,"Trailing Candidate" ,"Trailing Party", "Margin", "Status") | |
state_codes <- c("05","14","19","28","24") | |
ec_master <- c() | |
for(state in 1:length(state_codes)){ | |
sample_url <- paste0('http://eciresults.nic.in/statewiseS',state_codes[state],'.htm?st=S',state_codes[state]) | |
xpath <- '//*[@id="divACList"]/table[1]' | |
This file contains hidden or 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(plotflow) | |
library(reports) | |
## make a folder to store the pdfs | |
folder(deleteMe) | |
## paste the paths to pdfs together in one string w/ spaces | |
plotflow:::mergePDF( | |
in.file=paste(file.path("deleteMe", dir("deleteMe")), collapse=" "), | |
file="merged.pdf" |
This file contains hidden or 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
convert <- function(x) { | |
map <- c("\\[:alpha:\\]" = "a-zA-Z", "\\[:digit:\\]" = "0-9") | |
for (i in seq_along(map)) { | |
x <- gsub(names(map)[[i]], map[[i]], x) | |
} | |
x | |
} | |
convert("[[:alpha:]](?:(?:[[:digit:]]){1,2}(?:[[:alpha:]]){1,2})(?:(?:[[:digit:]]){6,7})") | |
#> [1] "[a-zA-Z](?:(?:[0-9]){1,2}(?:[a-zA-Z]){1,2})(?:(?:[0-9]){6,7})" |
This file contains hidden or 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
#!/usr/bin/env Rscript | |
args = commandArgs(trailingOnly = TRUE) | |
# What is this: A script that assists in following best practices when starting a new project | |
# What are these best practices: | |
# - Creating a project is the first step, managing individual scripts is a mess | |
# - Always have a git setup at the root of the project | |
# - A README.md file for documentation | |
# - A .gitignore file for ignoring files and directories, remember .DS_Store |
This file contains hidden or 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
args <- commandArgs(trailingOnly = TRUE) | |
library(ggplot2) | |
library(ggflags) | |
bg_color = '#5A8E38' | |
# Declaring constants ----------------------------------------------------- |
- US - No overarching data protection framework but Sector wise laws - GLB - provisions for collection and use of financial data
- EU - GDPR (Replaces the Data Protection Directive of 1995) - Technology and Sector agnostic
Current state in India - SPD Rules were issued under Section 43A of the IT Act -
- Against negligence in implementing and maintaining reasonable security practices and procedures while dealing with sensitive personal data or infoirmation
Entities:
This file contains hidden or 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
html_master <- c() | |
for(i in 1:3){ | |
pmjay_hospt <- 'https://hospitals.pmjay.gov.in/Search/empnlWorkFlow.htm' | |
req_params <- list("actionFlag"= 'ViewRegisteredHosptlsNew', | |
"search"= 'Y', | |
"appReadOnly"= 'Y', | |
"pageNo"= i, | |
"searchState"= 23, | |
"searchDistrict"= 411, | |
"searchHospType"= -1, |
This file contains hidden or 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(rvest) | |
library(readr) | |
# This file needs to be read as text. | |
x <- readr::read_file("~/Downloads/Chandigarh.xls") | |
# Every file will have a table, the way it is structured in this sample. We just want to extract this table and convert it to a data frame | |
# Check and clean the file as per the structure of the original one. Headers and Rows need to be adjusted. | |
y <- x %>% read_html() %>% html_table(fill = TRUE) | |
z <- y[[1]] |
This file contains hidden or 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(readr) | |
library(dplyr) | |
# Change These | |
file_path <- "~/Downloads/budget_changelog_2020/changelog_2.csv" | |
file_export_path <- "~/Downloads/budget_changelog_2020/changelog_updated.csv" | |
changelog <- read_csv( | |
file_path, | |
col_types = cols( |