수술 전후의 혈액 검사 결과를 보여주는 '전후'라인 차트를 작성하려고합니다. 나는 307 쌍의 데이터를 가지고 있기 때문에 수술 전 및 수술 후 데이터 (하나의 환자 : 한 명의 환자)에서 작성된 데이터 행렬의 각 307 열에 대해 선을 그려야합니다. 그래서 나는 이것을 시도했다 :회선 반복 설정()
ylabel<-"Platelet count (millions/ml)"
preoptpk<-c(100,101,102,103,104,105)
postoptpk<-c(106,107,108,109,110,111)
preoptpk<-t(matrix(preoptpk))
postoptpk<-t(matrix(postoptpk))
preoptpk
postoptpk
beforeandafterdata<-rbind(preoptpk, postoptpk)
beforeandafterdata
ylimits<-c(0.8*min(beforeandafterdata,na.rm=TRUE),1.15*max(beforeandafterdata, na.rm=TRUE))
ylimits
plot(beforeandafterdata[,1], type = "l", col = "black", xlim = c(0.9, 2.1),
ylim = ylimits, ann = FALSE, axes = FALSE)
title(ylab=ylabel, cex.lab=1.4)
axis(1,at=1:2,lab=c("Preop.","Postop."),cex.axis=1.5)
axis(2,labels=TRUE)
x<-c(1*2:6)
x
lines(beforeandafterdata[,x],type="l",col="black",
xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
. 그리고 아무 일도 일어나지 않았다. 내가 수동 2로 X를 정의 할 때부터 다음 3는 4 후 5 다음 6은 그것을 잘 작동합니다 : 나는 X < -c (307 일 * 2) : 사용할 수없는 이유를
이해가 안
x <- 2 x
lines(beforeandafterdata[,x],type="l",col="black",xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
x <-3 x
lines(beforeandafterdata[,x],type="l",col="black",xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
x <-4 x
lines(beforeandafterdata[,x],type="l",col="black",xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
x<-5 x
lines(beforeandafterdata[,x],type="l",col="black",xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
x<-6 x
lines(beforeandafterdata[,x],type="l",col="black",xlim=c(0.9,2.1),ylim=ylimits,ann=FALSE)
x<-c(1*2:6)
어떻게하면 도움이 될까요? 몇 가지 변수가 있고 각각 307 행을 수동으로 플로팅하면 시간이 많이 걸릴 것입니다. 답변 감사합니다.
FWIW에 결합되는 하나 개의 라인을 방지 할 필요 잘. – Justin
@Justin - 훨씬 좋습니다. 감사합니다 –
대단히 감사합니다!/오웨인. –