(免费课程转载)R入门与临床三线表绘制

我们一直努力为大家分享科研干货。从今天起,MedGo干货课堂上线啦

(免费课程转载)R入门与临床三线表绘制_第1张图片

首次分享课讲的是TCGA数据分析,探究某一因素与肿瘤临床数据之间的关系,并自动生成可以用于SCI发表的三线表,如下图所示:

(免费课程转载)R入门与临床三线表绘制_第2张图片

MedGo干货课题课程链接:https://m.qlchat.com/wechat/page/channel-intro?channelId=2000004352037294&shareKey=46a3afe0e2ee408fe98e99c69dc1f3bf&sourceNo=link&userSourceId=c816d24d312c&shareSourceId=z6p4e16a29d52774&from=singlemessage

(免费课程转载)R入门与临床三线表绘制_第3张图片
(免费课程转载)R入门与临床三线表绘制_第4张图片

我们在千聊上的直播间为 MedGo干货课堂,由生物信息界的小红人左手柳叶刀右手小鼠标同学分享~

本期视频免费,不过需要我们发送千聊优惠券,前期会有9张优惠券直接领(不要问我为啥是9张啊,我想写999张的)需要代码和资料的话请您关注医科狗微信公众号:

回复三线表可获取本次课程的代码和课件

回复20190417获取优惠券啦

代码分享:

#清除环境变量

rm(list=ls()) 



#加载所需的包

library("survival")

library("survminer")

library(dplyr)



#设置参数

options(stringsAsFactors = F)



#修改工作目录

setwd("C:\\Users\\czh\\Desktop\\material")



#读取数据

data <-  read.csv("dat.csv",header = T)



#删除缺失观测值

data <- na.omit(data)







#age单因素分析

data_age  <- data %>%

  dplyr::select(OS.Time, OS,age,ID)





res.cox <- coxph(Surv(OS.Time, OS) ~ age, data = data_age)

summary(res.cox)







#age数据提取

data_age  <- data_age %>%

  dplyr::select(age,ID)







#性别统计

tbl <- table(data$gender)

cbind(tbl,prop.table(tbl))







#gender数据提取

data_gender <- data

data_gender  <- data %>%

  dplyr::select(OS.Time, OS,gender,ID)





#gender单因素分析



data_gender <- subset(data_gender,gender =='FEMALE'| gender =='MALE')





data_gender$gender <- ifelse(data_gender$gender == 'FEMALE','1FEMALE','0MALE')



res.cox <- coxph(Surv(OS.Time, OS) ~ gender, data =data_gender)



summary(res.cox)







#grade数据提取

data_grade <- data

data_grade  <- data %>%

  dplyr::select(OS.Time, OS,grade,ID)





#grade单因素分析

data_grade  <- subset(data_grade ,grade=='High Grade'| grade=='Low Grade')

data_grade$grade <- ifelse(data_grade$grade == 'High Grade','1High','0low')

res.cox <- coxph(Surv(OS.Time, OS) ~ grade, data =data_grade )

summary(res.cox)







#tcell数据提取

data_tcell <- data

data_tcell  <- data %>%

  dplyr::select(OS.Time, OS,Tcell,ID)



#tcell单因素分析

data_tcell$Tcell <- ifelse(data_tcell$Tcell < median(data_tcell[,'Tcell']),'0low','1high ')





res.cox <- coxph(Surv(OS.Time, OS) ~Tcell, data = data_tcell)

summary(res.cox)







#tcell数据提取

data_tcell <- data

data_tcell  <- data %>%

  dplyr::select(Tcell,ID)





#stage数据提取

data_stage <- data

data_stage  <- data %>%

  dplyr::select(OS.Time, OS,stage,ID)



#stage单因素分析

data_stage <- subset(data_stage, stage=='Stage II'|stage=='Stage III'| stage=='Stage IV')



res.cox <- coxph(Surv(OS.Time, OS) ~ stage, data =data_stage)

summary(res.cox)





#多因素分析数据准备

data_new <- merge(data_age,data_stage,by='ID')  

data_new <- merge(data_new,data_tcell,by='ID')  





#多因素分析

res.cox <- coxph(Surv(OS.Time, OS) ~ age + stage  + Tcell , 

                 data = data_new  )

summary(res.cox)


qrcode_for_gh_2f89822775fb_344.jpg
欢迎关注医科狗


(免费课程转载)R入门与临床三线表绘制_第5张图片

您的生物医学科研好帮手!

你可能感兴趣的:((免费课程转载)R入门与临床三线表绘制)