My code:
function (var1, var2) {
if (var1 = flowrate) {label <- bquote('Flow rate ('*mu~'litre)'))}
else if (var1 = stress) {label <- bquote('Average velocity ('*m^2*s^-1*')')}
ggplot{} +
... +
ylab(label)
}
I want the ylab(label)
part to use the formula, but in this way it plots and prints it as a quoted string. E.g. when var1 = flowrate
, it prints bquote('Flow rate ('*mu~'litre)')
as the y axis, not interpreting the real meaning. Here is something similar, but cannot apply in my case: assigning a string to an object without double quotes
This must be a very crude way since I don't know the proper approach, but I would appreciate any suggestion for fixing this or better ways to achieve this.
Thanks for your time!