Hi Arun, I think that my data has another format. When I type the comand dput(time), it appears the following information: structure(list(date = structure(c(696L, 18L, 19L, 43L, 44L, 45L, 67L, 68L, 94L, 95L, 117L, 118L, 141L, 142L, 167L, 168L, 193L.......), .Label = c("01/01/2011 12:32", "01/02/2011 00:49", "01/02/2011 12:54",....), class = "factor")), .Names = "date", row.names = c(NA, 716L), class = "data.frame"). When I tried to convert to POSIXct , it gives me this thing:structure(c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real,NA_real_), class = c("POSIXct", "POSIXt"), tzone = "") Script I have done is: library(argosfilter) setwd("C:/Users/Usuario/Dropbox/Laila Aranda/PUFGRA") Geo = read.table("2370001_PUFGRA_2009_Gough_000_retarded10_both.trj",header=FALSE,sep = ",", col.names= c("type", "date", "secs", "Trans1", "Trans2", "lat.sta", "lat.comp", "long", "dist", "rumbo", "velocidad", "confianza")) location=subset(Geo, select= c(lat.comp,long)) time=subset(Geo, select =c(date)) k<-as.POSIXct( ¡time, format= "%d/%m/%y %H:%M") Laila PS: I've just realised that I made a mistake, because I want to merge two columns not rows. In fact, I have one column: dd/mm/yyyy mm:hh and another column(secs): 40567,87. I send you a picture of my database.
Date: Sun, 7 Jul 2013 18:10:09 -0700 From: ml-node+s789695n4671066...@n4.nabble.com To: laila_...@hotmail.com Subject: Re: Need hep for converting date data in POSIXct Hi, I am not sure how your dataset looks like. If it is like the one below: (otherwise, please provide a reproducible example using ?dput()) dat1<- read.table(text=" datetime 10/02/2010 02:30 11/02/2010 04:00 14/02/2010 06:30 ",sep="",header=TRUE,stringsAsFactors=FALSE) lst1<-split(dat1,(seq_along(dat1$datetime)-1)%%2+1) dat2<- data.frame(datetime=as.POSIXct(paste(lst1[[1]][,1],lst1[[2]][,1]),format="%d/%m/%Y %H:%M")) str(dat2) #'data.frame': 3 obs. of 1 variable: # $ datetime: POSIXct, format: "2010-02-10 02:30:00" "2010-02-11 04:00:00" ... dat2 # datetime #1 2010-02-10 02:30:00 #2 2010-02-11 04:00:00 #3 2010-02-14 06:30:00 #or data.frame(datetime=as.POSIXct(paste(dat1[seq(1,nrow(dat1),by=2),1], dat1[seq(2,nrow(dat1),by=2),1]),format="%d/%m/%Y %H:%M")) # datetime #1 2010-02-10 02:30:00 #2 2010-02-11 04:00:00 #3 2010-02-14 06:30:00 A.K. Hey everybody, I am a new user of R software. I don't know how I can merge two rows in one. In fact, I have one row with the date(dd/mm/yyyy) and another with the time (hh:mm) and I would like to get one row with date time in order to convert to POSIXct. How can I do it?? ______________________________________________ [hidden email] 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. If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Need-hep-for-converting-date-data-in-POSIXct-tp4671059p4671066.html To unsubscribe from Need hep for converting date data in POSIXct, click here. NAML data.docx (213K) <http://r.789695.n4.nabble.com/attachment/4671084/0/data.docx> -- View this message in context: http://r.789695.n4.nabble.com/Need-hep-for-converting-date-data-in-POSIXct-tp4671059p4671084.html Sent from the R help mailing list archive at Nabble.com. [[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.