[R] truth[(truth[, 1]=="G3" & truth[, 2]=="G2") | (truth[, 1]=="G2" & truth[, 2]=="G3"), 3]<-1

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Sun Sep 6 13:04:34 CEST 2020


I am afraid this is completely unreadable because you posted in HTML ad 
this is a plain text list. Best to resend it having set your mailer to 
send plain text as HTML gets mangled here.

Michael

On 06/09/2020 10:58, Hesham A. AL-bukhaiti via R-help wrote:
> 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]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list