This is the test data i made to try the code
df <- data.frame(stringsAsFactors = FALSE,
UniqueID = c(1),
Species = c("Aborre"),
Organ = c("Liver","Liver","Muscle","Muscle","Muscle"),
Parametre = c("Chem1","Chem2","Chem3","Chem4","Chem5"),
Unit = c("µg/kg vv","µg/kg vv","µg/kg vv", "ng/kg vv","ng/kg vv"),
Result = c(1,3,5,7,4)
)
database <- data.frame(stringsAsFactors = FALSE,
UniqueID = c(rep(1,5),rep(2,5),rep(3,5),rep(4,5)),
Species = c("Aborre"),
Organ = c("Liver","Liver","Muscle","Muscle","Muscle"),
Parametre = c("Chem1","Chem2","Chem3","Chem4","Chem5"),
Unit = c("µg/kg vv","µg/kg vv","µg/kg vv", "ng/kg vv","ng/kg vv"),
Result = c(3,2,5,9,8)
)
rules <- validator(Organ == Data_reference$Organ)
cf <- confront(df, rules, ref = list(Data_reference = database))
summary(cf)
This code only checks for one of the variables, but i need to check for all the varibles combined, so if UniqueID is =1 then i only need to the the rows in database where the uniqueID is = 1.
So can i make a code that checks UniqueID = 1 then Species = Aborre, then Organ = Liver, then Parametre = Chem1 and so on...