I have two data sets.
After merging them by a given ID, i want to compare two variables and report the ID or position where the values aren't equal. i.e. check whether value df$b[n]== df$b[n]
I have tried using comparebelow but it reports FALSE or TRUE
x.1 <- data.frame(id=c(1,2,3,4,5) , a=c(1,2,3,4,5), b=c(1,2,3,4,5))
x.1
x.2 <- data.frame(id=c(1,2,3,4,5) , a2=c(1,1,2,3,4), b2=c(1,1,99,3,4))
x.2
df <- merge(x.1,x.2,by="id")
comp <- compare(df$b,df$b2,allowAll=FALSE)
comp
comp$tM
You can put your condition in standard
[function asiargument, column that you want to show as argumentjanddrop = Fcontrols whether you want data.frame or vector in return in case you select only 1 column.