I would like to execute a logical operation using a character string (yes I want to do it this way)
a = data.frame(x=c(1,2,3,4),y=c(11,12,13,14))
logical_text = "a$x!=2 & a$y!=14"
a
> a
x y
1 1 11
2 2 12
3 3 13
4 4 14
I am hoping to use the string as follows
a[logical_text,]
> a[logical_text,]
x y
NA NA NA
In order to get the same result as:
a[a$x!=2 & a$y!=14,]
> a[a$x!=2 & a$y!=14,]
x y
1 1 11
3 3 13