Skip to content

Instantly share code, notes, and snippets.

@jackphilippi
Last active February 14, 2023 03:34
Show Gist options
  • Save jackphilippi/2805673f02ee357b575f3682dc1e338e to your computer and use it in GitHub Desktop.
Save jackphilippi/2805673f02ee357b575f3682dc1e338e to your computer and use it in GitHub Desktop.
data <- read.csv("~/Desktop/ref.csv")
result <- list()
if (nrow(data) %% 2 == 1) {
stop("CSV file must have an even number of rows.")
}
for (i in seq(1, nrow(data), by=2)) {
row1 <- data[i,]
row2 <- data[i+1,]
cat(paste("Comparing sum of ", row1[[1]], " + ", row2[[1]], "\n"))
if (row1[[1]] + row2[[1]] != 0) {
result <- c(result, list(c(row1[[2]], row2[[2]])))
cat("^ Mismatch!\n")
}
}
cat(paste("Mismatching Ids = ", result, "\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment