Skip to content

Instantly share code, notes, and snippets.

View mkim0710's full-sized avatar

mkim0710 mkim0710

View GitHub Profile
@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
# 셀레늄 패키지와 rvest 패키지를 설치합니다.
source("https://install-github.me/ropensci/RSelenium")
install.packages("rvest")
install.packages("dplyr")
# 패키지를 불러서 사용할 준비를 합니다.
library(RSelenium)
library(rvest)
library(dplyr)
@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)
```
@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 / 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 / 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 / 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 / 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 / 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 / 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)