[R] statment can tacke value in row1 and rows

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Sep 3 03:27:24 CEST 2020


Please re-post in plain text. This is a plain text list and html can get
messed up, as here.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Sep 2, 2020 at 6:18 PM Hesham A. AL-bukhaiti via R-help <
r-help using r-project.org> wrote:

> hello.I have this code :#################################3#read data just
> thee columns. first and second columns are catogary , third column  is
> number. out<-read.csv("outbr.csv")
> truth<-out[,seq(1,2)] #truth about 2000 rows, some values in row1 can
> show in rows2,and the some values in row2 can also show in row1 :
> #for example :#G1(row1), G2(row2)
> #G2(row1),G1(row2)
> #if this happend add to thrid column in truth 1 otherwise add 0 as in
> statment
> followtruth<-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 ###############################3Q:# i want make loop
> take all 2000 rows and comparsion between all values in row one and row two
> :
> #Gi(value in row1), Gj(value in row2)
> #Gj(varow1),Gi(row2), #############more :#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
> (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.
>
>         [[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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list