[R] Superscripts and rounding

ehux emily.huxter at ec.gc.ca
Mon Jul 27 17:08:04 CEST 2009


I am new to the world of R/programming so this may be a really easy question.
I thank you for your patience and help in advance 

I would like the characters km^2 to be displayed on the plot subtitle as km
squared - two as a superscript. 

I would also like to have the numbers from the data set for longitude and
latitude to be rounded to four decimal places.

Thank you.

plot (
  decade[['date']],
  decade[['value']],

  type = 'l',
  col = 'lightsteelblue4',
  ylab = 'Discharge [cms]',
  main = sprintf('%s [%s]', stn[['metadata']][['name']],
stn[['metadata']][['id']]),
  km^2 <- expression
  sub = sprintf('Seasonal station with natural streamflow - Lat: %s Lon: %s
        Gross Area %s km^2 - Effective Area %s km^2',
stn[['metadata']][['latitude']],
        stn[['metadata']][['longitude']],stn[['metadata']][['grossarea']],
        stn[['metadata']][['effectivearea']]),
  cex.sub = 1, font.sub = 3, col.sub = "black"
  )
-- 
View this message in context: http://www.nabble.com/Superscripts-and-rounding-tp24682319p24682319.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list