user138773 - 9 months ago 38

R Question

I'm wondering how I can **replace the multiplication sign (i.e., x) with its ASCII code (**

`Alt 0215`

`text()`

`Shiny`

`G1 = 1`

G2 = 2

type = 1

plot(1:10, ty = "n", ann = F, bty = "n")

text(6, 6,

bquote(paste("GG = ", frac(.(G1), .(G2)),

.(ifelse(type == 1, " × 2", "")), ## HERE is where I need to use the ASCII code for "×"

" = ",

.(ifelse(type == 1, G1/G2 * 2, G1/G2)), sep = "")),

col = "red4", cex = 1.6)

Answer Source

Try this:

```
plot(1:10, ty = "n", ann = F, bty = "n")
v <- if (type == 1) G1/G2 * 2 else G1/G2
text(6, 6, bquote({GG == frac(.(G1), .(G2)) * " \u00D7 2"} == .(v)),
col = "red4", cex = 1.6)
```