Re: [R] replace NA value with 0

2010-03-17 Thread ehux
Building on the question how to replace NA with 0. My data set below has date, station 1, flags for station 1, station 2, flags for station 2, etc... I would like to make the values in the station columns equal to 1 and the NA in the station columns equal to 0 and then sum each row for the numbe

Re: [R] Superscripts and rounding

2009-07-30 Thread ehux
WORKS!! Thank you for all your help! plot ( decade[['date']], decade[['value']], type = 'l', col = 'lightsteelblue4', ylab = 'Discharge [cms]', main = sprintf('%s [%s]', stn[['metadata']][['name']], stn[['metadata']][['id']]), sub = sprintf('Seasonal station with natural

Re: [R] Superscripts and rounding

2009-07-30 Thread ehux
This code WORKS but i can not get it to work when i add the rest of the sub-title. I have tried three different ways. # WORKS plot ( decade[['date']], decade[['value']], type = 'l', col = 'lightsteelblue4', ylab = 'Discharge [cms]', main = sprintf('%s [%s]', stn[['metadata']

Re: [R] Superscripts and rounding

2009-07-30 Thread ehux
could it be that the values accessed in the database are not integers or numeric??? -- View this message in context: http://www.nabble.com/Superscripts-and-rounding-tp24682319p24747282.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Superscripts and rounding

2009-07-30 Thread ehux
Good one!! Although i think it is stn - none the less neither works. Polwart Calum (County Durham and Darlington NHS Foundation Trust) wrote: > > Duh! did it again! the variables need str in front of them don't they!! > > sub = sprintf('Seasonal station with natural streamflow - Lat: %s Lon

Re: [R] Superscripts and rounding

2009-07-30 Thread ehux
I'd need access to the whole data file. I tried exporting some data from the website for it but it got too complex for me! (oh right you need the HYDAT package - sorry about that) =) However, it seems to me you have two chunks of data: you got it!!! stn[flow] - which has daily flow data in

Re: [R] Superscripts and rounding

2009-07-29 Thread ehux
library(RODBC) library(HYDAT) You will need to install HYDAT (the zip file) from http://www.geog.ubc.ca/~rdmoore/Rcode.htm Below is my current code - which works. The [[]] is the way i am accessing the columns from the data frame. thanks again for all your help # load HYDAT data par(mfrow

Re: [R] Superscripts and rounding

2009-07-28 Thread ehux
I receive the error message below - but i agree with you it should work? In fact i don't care if it rounds it can just cut the number at 4 decimal places. Error: unexpected symbol in: " sub = sprintf('Seasonal station with natural streamflow - Lat: %s Lon: %s Gross Area %s km\UB2 - Effective

Re: [R] Superscripts and rounding

2009-07-28 Thread ehux
I am in Canada and it worked!! as:\some text\UB2 the round did not work. i also tried nsmall - to specify number of digits to the right to the decimal to no avail. i will keep trying and post if something does work. Polwart Calum (County Durham and Darlington NHS Foundation Trust) wrote

Re: [R] Superscripts and rounding

2009-07-28 Thread ehux
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']]), I tried you

[R] Superscripts and rounding

2009-07-27 Thread ehux
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 fo