Copyright 2019 - Matt Harrison
@__mharrison__
```{r} | |
#set UCR codes for Chicago | |
# 2020 http://gis.chicagopolice.org/website/clearMap_crime_sums/crime_types.html | |
# 2021 http://directives.chicagopolice.org/forms/CPD-63.451_Table.pdf | |
# 2021 above from footer of http://directives.chicagopolice.org/directives/data/a7a57bf0-12d7196c-11f12-d71a-3c76ad6f2c11950a.html | |
# 2021 above search from | |
# 388v01::34:51 which | |
# 538, grepl | |
# Murder | |
UCR01 = "0110|0130" |
Data Understanding (1-5) | |
1. Industry data belongs to: Ecommerce | |
2. Find count of observations and variables,(use glimpse): 51290 & 24 | |
3. Know data types (use glimpse) | |
4. Levels: (use glimpse) | |
5. See if any negatives (because this is ecommerce data) | |
```{r} | |
glimpse(df99) | |
summary(df99) | |
``` |
z_score <- function(x, m, sd){ | |
return ((x-m)/sd) | |
} | |
x_val <- function(z, m, sd){ | |
return (z*sd + m) | |
} | |
m <- 100 | |
sd <- 15 |
library(readxl) | |
library(tidyverse) | |
library(psych) | |
library(scales) | |
setwd("C:/Users/tradingbills/Documents/_exer/_data/math/wk4/") | |
# 1 compute the covariance | |
# COV = Sum( (x_i - x_bar) * (y-i -y_bar)) / N-1 | |
# COVARIANCE | |
covariance <- function(x,y){ |
# lm -- -- -- -- -- -- -- -- -- -- 604 Linear Regression | |
# from Statistics 101: Linear Regression, Residual Analysis | |
# youtube.com/watch?v=gLENW2AdJWg | |
bill <- c( 34, 108, 64 , 88 , 99 , 51 ) | |
mean(bill) | |
tip <-c ( 5, 17, 11, 8, 14, 5 ) | |
mean(tip) | |
#correlation coefficient = covariance / co-standard-deviation |
Data Understanding (1-6) | |
#1. Industry data belongs to; 2. Observations and variables count: ; 3. Data types | |
#4. Levels: ; 5. Any negatives (when ecommerce data); 6 Find Nulls | |
#1 Industry data belongs to: | |
#2 Observations & Variable Count | |
```{r} | |
library(skimr); skim(df99) | |
library(psych); describe(df99) | |
summary(df99) |
# IUCR codes for Ill. define for ifelse grepl below | |
# code found at # http://gis.chicagopolice.org/website/clearMap_crime_sums/crime_types.html | |
UCR01 = "0110|0130" | |
UCR02 = "0261|0262|0263|0264|0265|0266|0271|0272|0273|0274|0275|0281|0291|1753|1754" | |
UCR03 = "0312|0313|031A|031B|0320|0325|0326|0330|0331|0334|0337|033A|033B|0340" | |
UCR04A = "051A|051B|0520|0530|0550|0551|0552|0553|0555|0556|0557|0558" | |
UCR04B = "041A|041B|0420|0430|0450|0451|0452|0453|0461|0462|0479|0480|0481|0482|0483|0485|0488|0489|0490|0491|0492|0493|0495|0496|0497|0498" | |
# assert == VC by UCR code & append col GUCR for a global variable holding codes in long form for respective crimes | |
chicago_ds_2015_gte$GUCR = ifelse(grepl(UCR01, chicago_ds_2015_gte$IUCR), "UCR01", |
// win10/_exer/_playground/queryString/index.js | |
const queryString = require('query-string'); | |
const ef1059 = "https://graph.facebook.com/oauth/authorize?client_id=<client_id>&scope=read_insights,manage_pages,publish_pages,user_posts,publish_actions,publish_to_groups&redirect_uri=https://ui.benchmarkemail.com/FacebookAuthorize" | |
const myQs = ef1059.split('?'); | |
console.log(queryString.parse(myQs[1], {arrayFormat: 'comma'})); |
" Automatically populate the g:airline_symbols dictionary with the powerline symbols. | |
let g:airline_powerline_fonts = 1 | |
" Also for airline, show the buffers in a list of there's only one tab open. | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_theme="hybrid" | |
let g:enable_italic_font = 1 | |
let g:hybrid_transparent_background = 1 |