[R] Ordering the rows of a data frame
dmitry.v.pavlyuk at gmail.com
Fri Jan 3 18:21:37 CET 2014
Bert, why do you think that "attach" is not working in this case? Did
you check it before your advice? :)
I agree about "generally bad approach", but it is quite convenient for
work with one data set.
On 03/01/2014 18:28, Bert Gunter wrote:
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (650) 467-7374
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> H. Gilbert Welch
> On Fri, Jan 3, 2014 at 7:08 AM, Dmitry Pavlyuk
> <dmitry.v.pavlyuk at gmail.com> wrote:
>> Hi Sofia!
>> You need to attach the data file before sorting:
> This is false! -- and generally a bad idea. See ?with
> Please do not give advice without checking whether it is correct.
> -- Bert
>> or just use full qualified names (like df_final$Y_init)
>> On 03/01/2014 16:41, Stefano Sofia wrote:
>>> Dear R users,
>>> I have two files of seasonal rainfall data (more than 10,000 rows each); here the first 8 rows of each file are reported.
>>> I have to load them as data frames, to merge them and sort them by (Y_init,M_init,D_init,Code_Raingouge).
>>> I wrote a short function where I first load the two files as data frames
>>> df_1 <- read.csv(file="prec_all_19521201_19821201.csv", sep=",")
>>> df_2 <- read.csv(file="prec_all_19821201_20111201.csv", sep=",")
>>> then I merge them by
>>> df_final <- merge(df_1, df_2, all=TRUE)
>>> and finally I try to order df_final through
>>> df_final <- df_final[order(Y_init, M_init, D_init, Code_Raingouge), ]
>>> but this returns only the first row.
>>> I read the manual carefully and I saw some examples, but I have not been able to do this simple task.
>>> I spent quite a long time and now I decided to ask the list.
>>> Could please somebody help me to show me where the mistake is?
>>> Thank you
>>> 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âEUR^(TM)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]]
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help