I need to compare two data.frames of one row each. To explain my issue I present a short reprex:
segID_1<- data.frame(stringsAsFactors=FALSE,
SegID_1 = c("*WHA_RBV", "!DHqI_*PUT", "!BXhV_!BXhW", "SIN_SUNUM",
"!Auql_KARDE", "ADUXO_DISVU", "INB_MIMTO")
)
segID_2<- data.frame(stringsAsFactors=FALSE,
SegID_2 = c("*WHA_RBV", "GHKJ_GDIU", "!BXhV_!BXhW", "*WHA_RBV",
"!BXhV_!BXhW", "ADUXO_DISVU", "GHKJ_GDIU")
)
Conflicto<- data.frame(stringsAsFactors=FALSE,
Conflicto = c("YES", "NO", "YES", "NO", "NO", "YES", "NO")
)
number_of_yes<- data.frame(
Nº.YES = c(3, NA, NA, NA, NA, NA, NA)
)
number_of_no<- data.frame(
Nº.NO = c(4, NA, NA, NA, NA, NA, NA)
)
data.frame "segID_1" and "segID_2" are the data I would like to compare row by row. Both have the same number of rows and are non-numeric data. What I would like the code to do, is to compare the names row by row of these 2 data.frames and return a solution in another column or data.frame: YES if rows are equal, NO if they are different. Finally, I would like to count the number of YES and NO. In the example given, solution of what I would like to have is shown in data.frames: "Conflicto","number_of_yes" and "number_of_no".
Thanks in advance!