[R] formatting expressoion(paste with line shift

Troels Ring tring at gvdnet.dk
Fri Feb 26 13:08:58 CET 2016


Dear friends - I find it difficult to get formatting right when 
expressions are made on several lines. Sorry not to find the right 
documentation.
R version 3.2.1 Windows 7



(pHi <- seq(1,8))
#This gets formatted well but I want subscript for 2 in pCO2
  plot(pHi,type="s",axes=FALSE,xlab="",lwd=4,
main=paste("Theoretical experiment using SID = 0.13 M\n"," ATOT = 0.2 M, 
pKa = 6.8, and pCO[2] = 40"))

#but this gets a very unhelpful format

plot(pHi,type="s",axes=FALSE,xlab="",lwd=4,
main=expression(paste("Theoretical experiment using ", pCO[2], "= 40, 
SID = 0.13 M\n"," ATOT = 0.2 M, and pKa = 6.8",
  )))

All best wishes
Troels
Aalborg
Denmark



More information about the R-help mailing list