Skip to content

Instantly share code, notes, and snippets.

View mkim0710's full-sized avatar

mkim0710 mkim0710

View GitHub Profile
@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>
@mkim0710
mkim0710 / matrix to integer.r
Last active October 19, 2018 16:45
matrix to integer.r
set.seed(1)
m = array(runif(12) * 10, c(3, 4))
class(m)
typeof(m)
dput(m)
# > class(m)
# [1] "matrix"
# > typeof(m)
# [1] "double"
@mkim0710
mkim0710 / matrix to integer -void.r
Last active October 19, 2018 16:25
matrix to integer -void.r
set.seed(1)
m = array(runif(12) * 10, c(3, 4))
dput(m)
# > dput(m)
# structure(c(2.655086631421, 3.7212389963679, 5.72853363351896,
# 9.08207789994776, 2.01681931037456, 8.98389684967697, 9.44675268605351,
# 6.60797792486846, 6.2911404389888, 0.617862704675645, 2.05974574899301,
# 1.76556752528995), .Dim = 3:4)
m2 = as.integer(m)
dput(m2)
@mkim0710
mkim0710 / onedrive-ubu.sh
Created September 15, 2018 00:29 — forked from glmdev/onedrive-ubu.sh
A bash script to setup OneDrive integration with GNOME on Ubuntu.
#!/bin/sh
# onedrive-ubu.sh
# A BASH script to set up OneDrive integration with GNOME on Ubuntu
# Copyright (C) 2018 Garrett Mills ([email protected])
# This software is licensed under the MIT License.
# This sofware is provided without warranty or even any implied intent of purpose.
#
# OnedriveD: https://github.com/xybu/onedrived-dev
#
@mkim0710
mkim0710 / saveRDS.Rmd
Created September 3, 2018 19:08 — forked from dgrtwo/saveRDS.Rmd
saveRDS speed and size
---
title: "Effect of compression type and file complexity on saveRDS size and speed"
author: "David Robinson"
date: "April 20, 2015"
output: html_document
---
```{r echo = FALSE}
knitr::opts_chunk$set(cache = TRUE, message = FALSE)
```
# 셀레늄 패키지와 rvest 패키지를 설치합니다.
source("https://install-github.me/ropensci/RSelenium")
install.packages("rvest")
install.packages("dplyr")
# 패키지를 불러서 사용할 준비를 합니다.
library(RSelenium)
library(rvest)
library(dplyr)
@mkim0710
mkim0710 / ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34.rowMeansReverseCoded.na.omit from .r
Created July 29, 2018 16:47
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34.rowMeansReverseCoded.na.omit from .r
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate(
Q3138rowMeansReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38)/8 # remove labels
, Q3138rowSumsReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38) # remove labels
) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138"))
# > ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate(
# + Q3138rowMeansReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38)/8 # remove labels
# + , Q3138rowSumsReverseCoded = as.numeric(Q31 + 6 - Q32 + Q33 + 6 - Q34 + Q35 + Q36 + 6 - Q37 + 6 - Q38) # remove labels
# + ) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138"))
# # A tibble: 191 x 10
@mkim0710
mkim0710 / ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34.rowMeans.na.omit from .r
Created July 28, 2018 20:32
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34.rowMeans.na.omit from .r
ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate(
Q3138rowMeans = rowMeans(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T)
, Q3138rowSums = rowSums(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T)
, Q4044rowMeans = rowMeans(.[, c("Q40", "Q41", "Q42", "Q43", "Q44")], na.rm = T)
, Q4044rowSums = rowSums(.[, c("Q40", "Q41", "Q42", "Q43", "Q44")], na.rm = T)
) %>% select(Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, matches("Q3138"), Q40, Q41, Q42, Q43, Q44, matches("Q4044")) %>%
# > ID_207_Group_Project_Version_2_Vertical_July_24_2018_07_34 %>% mutate(
# + Q3138rowMeans = rowMeans(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T)
# + , Q3138rowSums = rowSums(.[, c("Q31", "Q32", "Q33", "Q34", "Q35", "Q36", "Q37", "Q38")], na.rm = T)
--#@@ [Research] HCCI MDD annual prevalence 180501.pptm -p128.sql ----
select count(z_patid), count(distinct z_patid)
from hcci.MEMBER_SDDV2_1115
where (
z_patid in (
select z_patid
from hcci.MEMBER_SDDV2_1115
where (
gdr in ('1', '2')
#@ function.11matching.by.factors() -----
function.11matching.by.factors = function(data, varname4MatchingUpon = "diabetes", varnames4MatchingBy = c("age", "sex"), seed = 1) {
library(tidyverse)
if ("RowNum_original" %in% names(data)) {
warning('"RowNum_original" %in% names(data)')
} else {
data$RowNum_original = 1:nrow(data)
}
set.seed(seed)
data$runif = runif(nrow(data))