[R] (i want change G3 and G2 to variable tke all elements in rows) (truth[(truth[, 1]=="G3" & truth[, 2]=="G2") | (truth[, 1]=="G2" & truth[, 2]=="G3"), 3]<-1

Hesham A. AL-bukhaiti he@h@m|bb @end|ng |rom y@hoo@com
Mon Sep 7 05:48:32 CEST 2020


helloout<-read.csv("outbr.csv")truth<-out[,seq(1,2)]for example :
 If row1= G1 and row2=G2 , and row 1 = G2 and row 2= G1,make G3=1 # note G1 and G2 are values from 1 to 2000 #if this happend add to thrid column in truth 1 otherwise add 0 as in statment follow
truth<-cbind(as.character(truth[,1]),as.character(truth[,2])             ,as.data.frame(rep(0,,dim(out)[1])));#here just G2 and G3, i want make loop to cam[are all values from G1 to G2000 
truth[(truth[,1]=="G3" & truth[,2]=="G2") | (truth[,1]=="G2" & truth[,2]=="G3"),3]<-1 ###############################3(Simply they regulate the other. If element A is in the first group , and it is related to element B in the second group , and element B also in  in the first group , and it is related to element A(the same element  in the first group)  in the second group , we write 1 and otherwise 0.
this the distination result:
I want this result
G1 G2  G3 D    B    1 B   D     1 A    D    0 B    A    1B    C    0A   B    1

	[[alternative HTML version deleted]]



More information about the R-help mailing list