Inline 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.pavl...@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 > > attach(df_final) > > or just use full qualified names (like df_final$Y_init) > > Dmitry > > 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. >> >> Code_Raingouge,Y_init,M_init,D_init,h_init,m_init,Y_fin,M_fin,D_fin,h_fin,m_fin,Rainfall,N_Values,Quality_Level,Code_Station >> 2000,1952,12,1,0,0,1953,3,1,0,0,307.20,90,100.0,1510 >> 2000,1953,3,1,0,0,1953,6,1,0,0,153.60,92,100.0,1510 >> 2000,1953,6,1,0,0,1953,9,1,0,0,181.00,92,100.0,1510 >> 2000,1953,9,1,0,0,1953,12,1,0,0,202.40,91,100.0,1510 >> 2000,1953,12,1,0,0,1954,3,1,0,0,153.80,90,100.0,1510 >> 2000,1954,3,1,0,0,1954,6,1,0,0,286.20,92,100.0,1510 >> 2000,1954,6,1,0,0,1954,9,1,0,0,142.80,92,100.0,1510 >> 2000,1954,9,1,0,0,1954,12,1,0,0,186.60,91,100.0,1510 >> ... >> >> Code_Raingouge,Y_init,M_init,D_init,h_init,m_init,Y_fin,M_fin,D_fin,h_fin,m_fin,Rainfall,N_Values,Quality_Level,Code_Station >> 1056,2004,12,1,0,0,2005,3,1,0,0,93.60,2833,32.8,15 >> 1056,2005,3,1,0,0,2005,6,1,0,0,149.80,4406,49.9,15 >> 1056,2005,6,1,0,0,2005,9,1,0,0,52.80,1440,16.3,15 >> 1056,2005,9,1,0,0,2005,12,1,0,0,191.80,1201,13.7,15 >> 1056,2005,12,1,0,0,2006,3,1,0,0,26.40,336,3.9,15 >> 1056,2006,12,1,0,0,2007,3,1,0,0,59.00,3604,41.7,15 >> 1056,2007,3,1,0,0,2007,6,1,0,0,181.16,4414,50.0,15 >> 1056,2007,6,1,0,0,2007,9,1,0,0,96.00,7337,83.1,15 >> ... >> >> 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 >> 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â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@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. > > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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. > ______________________________________________ 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.