ehux wrote:
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"
)
Since I do not have the data I can only guess:
sub = substitute('Seasonal station with natural streamflow - Lat:' * a *
' Lon:' * b * ' Gross Area ' * c * km^2 * ' - Effective Area ' * d * km^2',
list(a = stn[['metadata']][['latitude']],
b = stn[['metadata']][['longitude']],
c = stn[['metadata']][['grossarea']],
d = stn[['metadata']][['effectivearea']]))
Uwe Ligges
______________________________________________
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.