온라인에서이 문제에 대한 해결책을 찾지 못했습니다. 여기가있다 : 나는이 이름이 같은 dataframe가 DF1 있습니다data.frame에서 행렬로 대체
PIM WDR MYC OBX
ILMN_1651282 0.555764 0.675233 0.5908629 0.4897703
ILMN_1651354 0.6963458 0.8588675 0.9216328 0.88705
ILMN_1651358 0.7501548 0.6766059 0.8157319 0.9373666
ILMN_1652716 0.5505098 0.5802357 0.7342341 0.5953167
ILMN_1654324 0.9294231 0.9311051 0.8424824 0.888825
ILMN_1654639 0.9197155 0.4687101 0.678938 0.4309232
ILMN_1655418 0.690068 0.6345875 0.9595042 0.6132203
이 이름 같은 dataframefile가 DF2 :
PIM WDR MYC OBX
ILMN_1651282 -1 -1 -1 -1
ILMN_1651354 -1 1 1 1
ILMN_1651358 1 1 1 1
ILMN_1652716 -1 -1 -1 -1
ILMN_1654324 -1 -1 -1 -1
ILMN_1654639 -1 -1 -1 -1
ILMN_1655418 1 1 -1 1
내가 0.8의 컷오프 값을 갖는다. DF1 0.8보다 큰 모든 값을 0으로 변경 0.8 미만 값 DF2의 값으로 대체한다 (1 & -1)
DF2가 생성 :
PIMvsEV<-list()
for (x in 1:nrow(df1)) {
t<-(if (mean(PIM[,x]) > mean(EV[,x])) {print(1)} else
if (mean(PIM[,x]) < mean(EV[,x])) {print(-1)})
PIMvsEV[[x]]<-matrix(t)
}
WDRvsEV<-list()
for (x in 1:nrow(df1)) {
t<-(if (mean(WDR[,x]) > mean(EV[,x])) {print(1)} else
if (mean(WDR[,x]) < mean(EV[,x])) {print(-1)})
WDRvsEV[[x]]<-matrix(t)
}
OBXvsEV<-list()
for (x in 1:nrow(cdf1)) {
t<-(if (mean(OBX[,x]) > mean(EV[,x])) {print(1)} else
if (mean(OBX[,x]) < mean(EV[,x])) {print(-1)})
OBXvsEV[[x]]<-matrix(t)
}
MYCvsEV<-list()
for (x in 1:nrow(df1)) {
t<-(if (mean(MYC[,x]) > mean(EV[,x])) {print(1)} else
if (mean(MYC[,x]) < mean(EV[,x])) {print(-1)})
MYCvsEV[[x]]<-matrix(t)
}
dataframe<-as.data.frame(cbind(as.matrix(PIMvsEV), as.matrix(WDRvsEV)))
dataframe<-as.data.frame(cbind(as.matrix(dataframe), as.matrix(MYCvsEV)))
dataframe<-as.data.frame(cbind(as.matrix(dataframe), as.matrix(OBXvsEV)))
row.names(dataframe)<-colnames(ttest)
colnames(dataframe)<-c("PIM","WDR","MYC","OBX")
어떤 생각? 사전에 많은 감사,
적용 기능을 사용해 보셨습니까? http://nsaunders.wordpress.com/2010/08/20/a-brief-introduction-to-apply-in-r/ –
빠른 Q, 어떻게 df2를 파생 시켰습니까? –
df1의 데이터에 행과 같은 행이 있다고 가정하는 것이 맞습니까? EV는 무엇입니까? –