mathexpression <- expression(
paste(
"log",
bgroup("(", #1open
paste(
"log",
bgroup("(", #2open
bgroup("(",frac(1,2)%*% #3open
bgroup("(",1+exp(-beta),")"), #4openclose
")")^-frac(1,beta), #3close
")")^-frac(1,gamma) #3close
),")")#1close and paste close
)#paste
)#expression
plot(0,0)
mtext(side=1, mathexpression)
Looking to have this expression in a ggplot geom text. I understand that geom_text does not take an expression but a string. I need help constructing this string containing a bgroup so ggplot can parse it.