My end goal is to have R evaluate my set of expressions. They look something like:
b
1 5+5+5+55555
2 1+5+5+55555
3 5-5+5+55555
4 1-5+5+55555
5 5*5+5+55555
6 1*5+5+55555
7 5/5+5+55555
8 1/5+5+55555
9 5+1+5+55555
10 1+1+5+55555
11 5-1+5+55555
but there are 2 million of them. After much finagling, I got the following to work as a proof of concept.
q <- apply(b,1,function(x){eval(parse(text=x))})
and that works for a smaller subset where all the expressions make sense. But because I'm just being lazy and doing brute force, not all of the expressions evaluate properly.
Like
5+5+5+5(555
Error in parse(text = x) : <text>:2:0: unexpected end of input
Can I tell R to be ok with that, and just return NA or FALSE or something else, but not break the code. I suppose I can go back and grep out the ones that won't evaluate, but I'm curious if I can make R just go with it.
Thanks!