Skip to content

Instantly share code, notes, and snippets.

View mkim0710's full-sized avatar

mkim0710 mkim0710

View GitHub Profile
@mkim0710
mkim0710 / ffmpeg.md
Created October 24, 2020 07:57 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
@mkim0710
mkim0710 / neuralnetR.R
Created May 31, 2020 08:15 — forked from mick001/neuralnetR.R
A neural network exaple in R. Full article at: http://datascienceplus.com/fitting-neural-network-in-r/
# Set a seed
set.seed(500)
library(MASS)
data <- Boston
# Check that no data is missing
apply(data,2,function(x) sum(is.na(x)))
# Train-test random splitting for linear model
@mkim0710
mkim0710 / off_diagonal.R
Created May 12, 2019 09:32 — forked from dsparks/off_diagonal.R
Modifying select off-diagonal items in a matrix
# A method for modifying only select off-diagonal items in a matrix
# From "Thierry" and "Ben Bolker"
# At http://stackoverflow.com/a/11759744/479554
# A sample matrix
size <- 6
mat <- matrix(seq_len(size ^ 2), ncol = size)
print(mat)
# A companion matrix that indicates how "off" a diagonal is:
@mkim0710
mkim0710 / ExploreHiddenR.md
Created January 8, 2019 12:50 — forked from ZeccaLehn/ExploreHiddenR.md
[R] Explore Hidden Environments and Functions -- by example

Shows function Internals

library(BayesianFirstAid)
debugonce(bayes.t.test) # turns off debugging for function after first run
bayes.t.test(co2)

Returns hidden and unhidden environments

@mkim0710
mkim0710 / Experimenting with ChromeOS on VirtualBox.md
Created January 7, 2019 03:36 — forked from gerarldlee/Experimenting with ChromeOS on VirtualBox.md
Installing ChromeOS on VirtualBox using the NeverWare build

Installing ChromeOS on VirtualBox

  1. Download the NeverWare's ChromeOS build from http://www.neverware.com/freedownload

  2. Extract the *.bin.zip

  3. Convert it to VDI. vboxmanage convertdd chromiumos_image.bin chromiumos_image.vdi

  4. mv chromiumis_image.vdi C:\t\v\chromeos\

@mkim0710
mkim0710 / fread-demo.R
Created January 3, 2019 06:59 — forked from wush978/fread-demo.R
decompress bzfile and remove null string and read in fread
fread(sprintf("bzcat %s | tr -d '\\000'", filename))
@mkim0710
mkim0710 / gist:8f4c32d8bab04ad5a6b1ecb0a89aeadb
Created November 17, 2018 16:02
PDF and CDF of t-distribution
# https://www.facebook.com/groups/632755063474501/?multi_permalinks=1910139775736017&notif_id=1542238311570480&notif_t=group_highlights&ref=notif
t.pdf <- function(t,v){
y <- GAM((v+1)/2)/sqrt(v*pi*GAM(v/2)^2)*(1+t^2/v)^(-(v+1)/2)
return(y)
}
t.cdf <- function(b,n,t.pdf,v){
x <- seq(0,b,length=n)[2:(n-1)]
m <- length(x)
odd <- seq(1,m,2)
@mkim0710
mkim0710 / ExampleData4Time2Censor.r
Last active November 17, 2018 12:17
ExampleData4Time2Censor
#@ ExampleData4Time2Censor = read_csv(url("https://raw.githubusercontent.com/mkim0710/tidystat/master/data/ExampleData4Time2Censor.csv")) =====
library(tidyverse)
ExampleData4Time2Censor = read_csv(url("https://raw.githubusercontent.com/mkim0710/tidystat/master/data/ExampleData4Time2Censor.csv"))
ExampleData4Time2Censor %>% dput
ExampleData4Time2Censor %>% str(give.attr = F) #----
ExampleData4Time2Censor %>% as.tibble # ----
# > ExampleData4Time2Censor %>% dput
# structure(list(PERSON_ID = 1:20, AGE_GROUP = c(15L, 15L, 15L,
# 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
@mkim0710
mkim0710 / ExampleData4defineDate.MDD.r
Last active November 17, 2018 11:52
ExampleData4defineDate.MDD
#@ ExampleData4defineDate.MDD = read_csv(url("https://raw.githubusercontent.com/mkim0710/tidystat/master/data/ExampleData4defineDate.MDD.csv")) =====
library(tidyverse)
ExampleData4defineDate.MDD = read_csv(url("https://raw.githubusercontent.com/mkim0710/tidystat/master/data/ExampleData4defineDate.MDD.csv"))
ExampleData4defineDate.MDD %>% dput
ExampleData4defineDate.MDD %>% str(give.attr = F) #----
ExampleData4defineDate.MDD %>% as.tibble # ----
# > ExampleData4defineDate.MDD %>% dput
# structure(list(PERSON_ID = 1:20, DTH_YM = structure(c(NA, NA,
# 15399, 15705, 15917, 15583, NA, NA, NA, NA, NA, NA, NA, NA, 16039,
@mkim0710
mkim0710 / Stata-syntax-highlighting-notepad++.xml
Created October 23, 2018 06:30 — forked from bquistorff/Stata-syntax-highlighting-notepad++.xml
Notepad++ syntax highlighting file for Stata code
<NotepadPlus>
<UserLang name="Stata" ext="do ado" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="2" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="yes" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00// 00* 00/// 01 02 03/* 04*/</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>