Dear R users,
I have a very long data frame (50 years, more than 1.5 million rows) of daily
rainfall data from about 80 raingouges.
The data frame that I have been given looks like
Raingouge_number Station_number Year Month Day Rainfall
2004 2230 1951 1 1 2.60
2004 2230 1951 1 2 0.40
2004 2230 1951 1 3 0.00
2004 2230 1951 1 4 0.00
2004 2230 1951 1 5 0.20
2004 2230 1951 1 6 0.00
2004 2230 1951 1 7 0.00
2004 2230 1951 1 8 0.00
2004 2230 1951 1 9 0.00
2004 2230 1951 1 10 0.00
...
There could be some missing days. I have two questions.
1st question:
In order to handle eventual missing days I think that I have to transform three
separate numbers (Year, Month and Day) to Date.
Is there a format in as.Date suitable for this transformation or before all I
have to set all the months and days to two digits, remove spaces and then apply
as.Date with format "%Y%m%d"?
2nd question
In case of missing day, the corresponding row will be missing and then I have
to insert this new row and put -999.9 as Rainfall. Is there an easy way to do
that?
Thank you for your help
Stefano
________________________________
AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
informazioni confidenziali, pertanto è destinato solo a persone autorizzate
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche
possono contenere informazioni confidenziali e con privilegi legali. Se non si
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi
dellâart. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed
urgenza, la risposta al presente messaggio di posta elettronica può essere
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by
persons entitled to receive the confidential information it may contain. E-mail
messages to clients of Regione Marche may contain information that is
confidential and legally privileged. Please do not read, copy, forward, or
store this message unless you are an intended recipient of it. If you have
received this message in error, please forward it to the sender and delete it
completely from your computer system.
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.