geonhee-ahn / geonhee-ahn

0 stars 0 forks source link

마지막 과제 #2

Open geonhee-ahn opened 3 years ago

geonhee-ahn commented 3 years ago

title: "약동학 과제" author: "안건희(201831036)" output: word_document

과제

R markdown을 이용한 과제

배경

'데이터 과학을 활용한 약동학 파고들기' 수업에서 교수님께서 가르쳐주신 R markdown을 이용한 과제입니다. Github, R, 약동학 자료 생성 및 비구획 분석 등 다양한 내용을 배웠습니다.

자료분석 방법

$$ E = \frac{A}{B} $$

$$ \frac{n!}{k!(n-k)!} = \binom{n}{k} $$

$$ \begin{matrix} a & b & c \ d & e & f \ g & h & i \end{matrix} $$

사용한 R 코드 및 결과

    library(tidyverse)

pkConcTime <- read_csv('assignment.csv') %>% 
  mutate(TRT = as.factor(TRT)) %>% 
  mutate(Value = ifelse(Nominal_Time == 0, Value + 0.1, no = Value)) %>% 
  mutate(Value = ifelse(Nominal_Time == 0.167, Value + 0.1, no = Value)) %>% 
  select(Subject_No, Nominal_Time, TRT, Value)

SKgg <- function(df){
  Skeleton <- ggplot(df, aes(x=Nominal_Time, y=Value))  +
    scale_x_continuous(breaks = c(0, 4, 8, 12, 24, 36, 48), 
                       limit = c(0, 48)) +
    theme_bw() + 
    labs(x = 'Time (hour)', y = 'Plasma concentration of SKI2670 (ng/ml)') +
    theme(legend.justification=c(1, 1), 
          legend.position=c(0.99, 0.99),
          legend.background = element_rect(fill='gray95'),
          legend.title = element_text(size=9, face='bold'),
          legend.text = element_text(size=9),
          legend.key.width=unit(1.5,'line'),
          legend.key.height=unit(0.8,'line'))

  # Group ----
  Baseplot <- Skeleton + 
    stat_summary(aes(group=TRT, color = TRT), 
                 fun.data=mean_se, 
                 geom=c('errorbar'), width = 1) + 
    stat_summary(aes(group=TRT, color = TRT), 
                 fun.y=mean, 
                 geom=c('line'), size=0.3) +
    stat_summary(aes(group=TRT, shape = TRT), 
                 fun.y=mean, 
                 geom=c('point'), size=2) + 
    scale_colour_discrete(
      name  ='Dose',
      labels = c('20 mg (N=3)', '40 mg (N=3)', '80 mg (N=3)', '160 mg (N=3)', 'Placebo (N=4)'))+
    scale_shape_discrete(
      name  ='Dose',
      labels = c('20 mg (N=3)', '40 mg (N=3)', '80 mg (N=3)', '160 mg (N=3)', 'Placebo (N=4)'))

  return(Baseplot)
}

SKgg(pkConcTime) + 
  scale_y_continuous(breaks = seq(0, 100, 25)) +
  geom_hline(aes(yintercept = 0.1), colour="#990000", linetype="dashed")

결과

1학기 약리학 시간때 배운 혈중-약물 농도 그래프와 비슷한 양상으로 추출하였습니다.

토론 및 한계

R 프로그램을 처음 써보았고 평소 컴퓨터 코딩에 대해 깊이 있게 배워본적이 없어 수업 내용을 따라가다 막히는 부분이 있으면 상당히 가슴 졸였던 기억이 납니다. 비대면의 한계가 있었지만 교수님께서 피드백 해주시고 좋은 강의해주셔서 감사했습니다. 이번에 배운 내용을 미래에 쓸 기회가 생기면 잘 활용해보겠습니다.

업로드 위치

https://github.com/geonhee-ahn/geonhee-ahn

그림 첨부

![](C:\Users\USER\Downloads\Mr. ahn\graph.png)

아침 점심 저녁
비요뜨 김치찌개 연어회
shanmdphd commented 3 years ago

수고 많았어요. 잘 했습니다.