Skip to content

Instantly share code, notes, and snippets.

😜
Everything is fine.

Sungpil Han shanmdphd

😜
Everything is fine.
Block or report user

Report or block shanmdphd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 95-confidence-interval.R
library(tidyverse)
tibble(estimate = c(0.23, 0.52, 0.20, 0.03, 0.45, 0.05),
rse = c(55.9, 41.4, 45.1, 19.9, 46.6, 25.5)) %>%
mutate(lower_ci = estimate - 1.96 * rse/100 * estimate) %>%
mutate(upper_ci = estimate + 1.96 * rse/100 * estimate) %>%
mutate(ci = sprintf('%0.2f - %0.2f', round(lower_ci, 2), round(upper_ci, 2)))
# A tibble: 6 x 5
estimate rse lower_ci upper_ci ci
<dbl> <dbl> <dbl> <dbl> <chr>
@shanmdphd
shanmdphd / ggforce-multiple-page.R
Created Mar 5, 2019
ggforce 패키지를 사용해서 여러 페이지가 있는 PDF 파일 만들기.
View ggforce-multiple-page.R
library(tidyverse)
library(ggforce)
# 함수 정의 ----
plot_multiple <- function(page_num) {
Theoph %>%
ggplot(aes(Time, conc)) +
geom_point() +
geom_line(alpha = 0.1) +
@shanmdphd
shanmdphd / ncaRule.R
Created Sep 11, 2017
ncaRule.R nca 규칙에 대한 것입니다.
View ncaRule.R
# File should have the following columns
# SUBJ : Subject ID, any data type
# TRT: "R" or "T"
# GRP: "RT" or "TR"
# PRD: 1 or 2
# AUClast: numeric data type
# Cmax: numeric data type
# Tmax: numeric data type
# Other columns as you wish
@shanmdphd
shanmdphd / flatgs.sh
Last active Sep 11, 2017
Flatten PDFs with ghostscript (GS를 사용해서 PDF를 flattening할 수 있습니다. MacOS Sierra에서 테스트하였습니다.)
View flatgs.sh
# http://zeroset.mnim.org/2015/01/07/flatten-pdfs-with-ghostscript/
# https://unix.stackexchange.com/questions/162922/is-there-a-way-to-flatten-a-pdf-image-from-the-command-line
# There should be `flat` sub-directory.
for file in *.pdf; do
gs -dSAFER -dBATCH -dNOPAUSE -dNOCACHE -sDEVICE=pdfwrite \
-sColorConversionStrategy=/LeaveColorUnchanged \
-dAutoFilterColorImages=true \
-dAutoFilterGrayImages=true \
@shanmdphd
shanmdphd / fastBib.R
Last active Sep 8, 2017
Fast Bibliography Generation in R
View fastBib.R
knitr::write_bib(c('caffsim', 'NonCompart', 'ncar'), 'temp.bib')
capture.output(bibtex::read.bib('temp.bib'), file = 'temp.txt')
myBib <- readLines('temp.txt')
myBib[myBib == ''] <- '\n\n'
paste(gsub('_', '',myBib), collapse = '')
@shanmdphd
shanmdphd / my-reporters-setting.R
Created Sep 5, 2017
My favorite reporters setting
View my-reporters-setting.R
library(ReporteRs)
options('ReporteRs-fontsize' = 10)
potsub <- function(char) pot(char, textProperties(vertical.align = 'subscript'))
potsuper <- function(char) pot(char, textProperties(vertical.align = 'superscript'))
flexThis <- function(df){
df %>%
FlexTable(header.columns = TRUE) %>%
setFlexTableBorders(inner.vertical = mystyle$no, inner.horizontal = mystyle$std,
outer.vertical = mystyle$no, outer.horizontal = mystyle$big)
View keybase.md

Keybase proof

I hereby claim:

  • I am shanmdphd on github.
  • I am shanmdphd (https://keybase.io/shanmdphd) on keybase.
  • I have a public key whose fingerprint is B2DD 7A5A 439E 134B 1624 16B9 D13C BC36 7863 82BC

To claim this, I am signing this object:

@shanmdphd
shanmdphd / Scatter.md
Last active Oct 13, 2016
NONMEM accessaries
View Scatter.md

Scatter plot matrices (pairs plots)

View ui.R
library(shiny)
library(ggplot2)
dataset <- diamonds
fluidPage(
titlePanel("PEET2017"),
sidebarPanel(
You can’t perform that action at this time.