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(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 |
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
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 | |
}) |
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
# 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) |
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
_contracts = {} | |
class Contract: | |
@classmethod | |
def __init_subclass__(cls): | |
_contracts[cls.__name__] = cls | |
def __set__(self, instance, value): | |
self.check(value) |
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
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", |
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
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) |
NewerOlder