Advertisements

Say I have the below terms and operators

```
x <- 0
y <- '<'
z <- 1
```

and I have constructed this into a string:

```
paste(x, y, z) # "0 < 1"
```

How do I then get R to evaluate this string to give `TRUE`

?

I have tried `eval`

which returns a character

tried `parse`

which gives `cannot open the connection`

Thank you.

### >Solution :

You could use `eval`

and `parse`

with text like this:

```
x <- 0
y <- '<'
z <- 1
eval(parse(text = paste(x,y,z)))
#> [1] TRUE
```

^{Created on 2023-02-13 with reprex v2.0.2}