Skip to content

Instantly share code, notes, and snippets.

View mkim0710's full-sized avatar

mkim0710 mkim0710

View GitHub Profile
library(tidyverse)
library(readxl)
Big_Data_Management_Student_List_2018 = read_excel("D:/tmp.files/[[Big Data Management]] Student List 2018.xlsx")[1:44, c("First Name", "Last Name", "CWID")]
vec.new.file.name = Big_Data_Management_Student_List_2018 %>% transmute(new.file.name = paste0(`Last Name`, ", ", `First Name`, " (", CWID, ")")) %>% unlist %>% unname
current.folder = "D:/[[Big Data Management]] 2018/HW1"
original.file.name = "HW1 Gradesheet 2018.xlsx"
new.folder = "D:/[[Big Data Management]] 2018/HW1 Gradesheet 2018"
for (i in 1:length(vec.new.file.name)){
file.copy(
overwrite = T
@mkim0710
mkim0710 / library(RODBC) Big Data Management 2018 HW1 Grading.r
Last active February 19, 2018 18:53
library(RODBC) Big Data Management 2018 HW1 Grading
function.list_TABLE_NAME.sqlFetch_sqlColumns = function(channel) {
# source("https://gist.githubusercontent.com/mkim0710/09f4626f80edd8c837b8834ef1685f31/raw/e825646ba318ce55d491ea7a61696c1ec8a2dd1f/library(RODBC)%2520Big%2520Data%2520Management%25202018%2520HW1%2520Grading.r")
library(RODBC)
library(tidyverse)
out = filter(sqlTables(channel), TABLE_TYPE == "TABLE")$TABLE_NAME %>% map(function(x) {
tmp.list = list()
tmp.list$sqlFetch = sqlQuery(channel, paste0("SELECT * FROM ", x))
tmp.list$sqlColumns = sqlColumns(channel, x)
tmp.list
})
@mkim0710
mkim0710 / microbenchmark-blog-post.R
Created July 28, 2017 19:56 — forked from stephenturner/microbenchmark-blog-post.R
Code for GGD blog post on microbenchmark
# see blog post here:
# http://gettinggeneticsdone.blogspot.com/2015/01/microbenchmark-package-r-compare-runtime-r-expressions.html
library(dplyr)
library(nycflights13)
flights
# base
aggregate(flights$arr_delay, by=list(flights$carrier), mean, na.rm=TRUE)
@mkim0710
mkim0710 / contract.py
Created July 19, 2017 05:00 — forked from 20chan/contract.py
The Fun of Reinvention 최종
_contracts = {}
class Contract:
@classmethod
def __init_subclass__(cls):
_contracts[cls.__name__] = cls
def __set__(self, instance, value):
self.check(value)
url_Data <- readLines("https://raw.githubusercontent.com/issactoast/Machine-Learning-with-R/master/Data/house.txt") %>% paste(collapse = "\n")
houseData <- read.table(text = url_Data, header = FALSE, sep = ":")
houseData
for (i in 1:dim(houseData)[2]){
houseData[,i] <- gsub(paste("",i), "", houseData[,i])
}
houseData <- houseData %>% unlist() %>% as.numeric() %>% matrix(ncol = 14)
colnames(houseData) <- c("MEDV", "CRIM", "ZN", "INDUS",
"CHAS", "NOX", "RM", "AGE",
"DIS", "RAD", "TAX", "PTRATIO",
@mkim0710
mkim0710 / p1.r
Created March 22, 2017 23:17 — forked from Eunsol-Lee/p1.r
solve <- function(n) {
result <- largeSubtract(largeAdd(sumMultiple(n, 3), sumMultiple(n, 5)), sumMultiple(n, 15))
}
right <- function (string, char){
substr(string,nchar(string)-(char-1),nchar(string))
}
left <- function (string,char){
substr(string,1,char)