Dear Dennis, Dear Uwe, Dear David, many thanks for helping. Dennis and David, your solutions seemed perfectly fine, but when I applied it to my original problem, it did not show a title. Below is a (longer) minimal example (the first part is from the help page of bbmle). Is this a bug in bbmle? Hmmm...
library(bbmle) x <- 0:10 y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8) d <- data.frame(x,y) ## in general it is best practice to use the `data' argument, ## but variables can also be drawn from the global environment LL <- function(ymax=15, xhalf=6) -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE)) ## uses default parameters of LL (fit <- mle2(LL)) ml <- mle2(LL, fixed=list(xhalf=6)) mlp <- profile(ml) vars <- c(quote(theta), quote(beta)) plot(mlp, main=bquote(bold("Foo"~.(vars[[2]])))) Cheers, Marius On 2011-06-02, at 22:23 , Dennis Murphy wrote: > Hi: > > This seems to work: > > vars2 <- c(quote(alpha), quote(beta)) # returns a list of mode call > plot(0, 0, main = bquote(bold('Foo '~.(vars2[[2]])))) > > Expressions are only evaluated once, which means that inner > expressions are not evaluated. You need a call object rather than an > expression inside of bquote(). > > HTH, > Dennis > > On Thu, Jun 2, 2011 at 11:43 AM, Marius Hofert <m_hof...@web.de> wrote: >> Dear all, >> >> I have a vector of expressions and would like to "paste" some string to it >> before using it in a plot: >> >> vars <- vector("expression", 2) >> vars[1] <- expression(alpha) >> vars[2] <- expression(beta) >> plot(0, 0, main=substitute(bold("Foo" ~~ VAR), list(VAR=vars[2]) )) >> >> Although I tried hard, I just can't figure out how to solve this. The title >> should be "Foo <theta>", where <theta> is the greek letter. I tried some >> constructions with bquote but that wasn't successful... I also looked in the >> mailing list but couldn't find anything helpful [I am sure I overlooked >> something]. >> >> Cheers, >> >> Marius >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.