I have a really large Excel spreadsheet with many 'checks' on observations (300+ columns). The checks consist of Boolean operators (greater than, equals) and some summation/subtraction:
df <-data.frame(checkID = c(1,2,3,4), checkpart1 = c(50, 70, 111, 320),
checkpart2 = c("+", "==", "*", ">"), checkpart3 = c(18, 17, 6, 3), checkpart4 = c("==", NA, "-", NA), checkpart5 = c(80, NA,76,NA), checkpart6 = c(NA, NA, "==", NA), checkpart7 = c(NA,NA,590, NA))
head(df) ##this is the input
#checkID checkpart1 checkpart2 checkpart3 checkpart4 checkpart5 checkpart6 checkpart7
#1 50 + 18 == 80 <NA> NA
#2 70 == 17 <NA> NA <NA> NA
#3 111 * 6 - 76 == 590
#4 320 > 3 <NA> NA <NA> NA
INSERT CODE THAT MAKES THE EXCEL FUNCTIONS COME TO LIFE HERE.
Mind you that some rows have much longer checks than others, so you can't rely on the column names.
#outcome data frame should look like this, where the checks have been conducted:
View(outputchecks)
#checkID
#1 FALSE
#2 FALSE
#3 TRUE
#4 TRUE
Does anyone know of some tidyr/dplyr/other application in R that can execute these 'static functions' in the dataframe?
Thank you!