Hi, I am very new to R so these questions may seem simple! I have a huge 2 sets of data(matrix 5x20000++) in the following formats , for example "data.txt" and "data2.txt": Date Time X Y 03/03/1983 20:00 0.1 990 I would like to recreate a new matrix which filters through "data.txt" and "data2.txt" to get something as below : Date Time X_data1 X_data2 Y_data1 Y_data2 31/12/2000 12:00 2.2 5 0 990 So I basically need : 1) When Date AND Time from data1.txt and data2.txt match, list the corresponding X and Y values (X_data1,X_data2,Y_data1,Y_data2) Thank you in advance, and I hope I have been clear enough in my message -- View this message in context: http://r.789695.n4.nabble.com/Data-Handling-tp2307770p2307770.html Sent from the R help mailing list archive at Nabble.com.
Convert your datasets into xts objects and then do a cbind ordering by the column you want. Do a ?cbind. HTH Raghu On Fri, Jul 30, 2010 at 10:33 AM, Lily_stats [via R] < ml-node+2307770-1033893256-309606@n4.nabble.com<ml-node%2B2307770-1033893256-309606@n4.nabble.com>> wrote:> Hi, > > I am very new to R so these questions may seem simple! > > I have a huge 2 sets of data(matrix 5x20000++) in the following formats , > for example "data.txt" and "data2.txt": > > Date Time X Y > 03/03/1983 20:00 0.1 990 > > I would like to recreate a new matrix which filters through "data.txt" and > "data2.txt" to get something as below : > > Date Time X_data1 X_data2 > Y_data1 Y_data2 > 31/12/2000 12:00 2.2 5 > 0 990 > > So I basically need : > 1) When Date AND Time from data1.txt and data2.txt match, list the > corresponding X and Y values (X_data1,X_data2,Y_data1,Y_data2) > > Thank you in advance, and I hope I have been clear enough in my message > > ------------------------------ > View message @ > http://r.789695.n4.nabble.com/Data-Handling-tp2307770p2307770.html > To start a new topic under R help, email > ml-node+789696-608741344-309606@n4.nabble.com<ml-node%2B789696-608741344-309606@n4.nabble.com> > To unsubscribe from R help, click here< (link removed) >. > > >-- 'Raghu' -- View this message in context: http://r.789695.n4.nabble.com/Data-Handling-tp2307770p2307836.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Hi, I am trying to convert my dataset into xts. I have tried the following : data1<-read.table("data1.txt",header=F) data2<-read.table("data2.txt",header=F) data1.xts<as.xts(data1,descr="my new xts object) However, I get an error : Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format I understand that my date and time format might not be accepted and have tried to convert this but failed. Could you suggest something ? My date is in the format : dd/mm/yyyy My time is in the format : hh:00 Thank you in advance -- View this message in context: http://r.789695.n4.nabble.com/Data-Handling-tp2307770p2307936.html Sent from the R help mailing list archive at Nabble.com.