The part:
allMissing <- apply(instrument, 1, function(x) {
all(is.na(x) | x == "")
})
caused an error on my PC: C stack usage 15923856 is too close to the limit.
It's odd as my 'instrument' is a 1750 * 10 tibble.
Solved the issue by avoiding apply():
allMissing = rep(FALSE, nrow(instrument))
for (i in 1:nrow(instrument)) {
x = instrument[i,]
allMissing[i] = all(is.na(x) | x == "")
}
Might help :)