r中的情节标题下标

use*_*546 3 plot r subscript

我想补充标题"1999年至2008年美国PM2.5的排放",该标题使用r中的基础绘图功能.在那,我希望2.5成为PM的下标.如果PM2.5恰好位于字符串的末尾,我没有任何问题:

barplot(height = total.emissions$Emissions, names.arg=total.emissions$year,  
        xlab="Year", ylab= " Amount of emitted in tonsPM"2.5 ,   
        main = "Emissions from in the United States from 1999 to 2008PM"[2.5] )
Run Code Online (Sandbox Code Playgroud)

但如果它在字符串的中间,我就不能这样做.如果我把它分成两部分,如下:

barplot(height = total.emissions$Emissions, names.arg=total.emissions$year,  
        xlab="Year", ylab= " Amount of PM_[2.5] emitted in tons",   
        main = expression("Emissions from PM"[2.5] "in the United States from 1999 to 2008"))
Run Code Online (Sandbox Code Playgroud)

由于方括号,我收到错误说出意外的符号.

sgi*_*ibb 10

尝试使用该paste函数expression(参见?plotmath详细信息),例如:

plot(0, main = expression(paste("Emissions from ", PM[2.5], " in the United States from 1999 to 2008")))
Run Code Online (Sandbox Code Playgroud)