I want to produce multiple graphs from a single dataframe listing different pollutant levels in different cities. I can loop through data slices without difficulty to plot pollutant levels, but I cannot create a different title for each graph in a loop. The graph titles include chemical formulae.
qdf = data.frame(x = rnorm(10), y = rnorm(10))
PolTitle <- expression(paste(NO[2], " pollutant values"))
MultiTitles = list(expression(paste(NO[2], " pollutant values")),
expression(paste(PM[2.5], " pollutant values")))
ggplot(qdf, aes(x,y)) + geom_point() + ggtitle(PolTitle) # displays correctly
ggplot(qdf, aes(x,y)) + geom_point() + ggtitle(MultiTitles[2]) # unexpected parsing