using = inside bquote

439 views Asked by At
a <- "A"
bquote(.(as.name(a)) = 4)

Error: unexpected '=' in "bquote(.(as.name(a)) ="

bquote(A = 4)

Error in bquote(A = 4) : unused argument (A = 4)

a <- "A"
bquote(f(.(as.name(a)) = 4))

Error: unexpected '=' in "bquote(f(.(as.name(a)) ="

How can I get around this?

1

There are 1 answers

0
akrun On

We don't need as.name

plot(1, 1, main = bquote(.(a) == 4))

-output

enter image description here


or another option with quotes

plot(1, 1, main = bquote(.(a)~'= 4'))