Hi Laila,
There is only one column from the dput() output.
time1<- structure(list(date....
str(time1)
#'data.frame':??? 20 obs. of? 1 variable:
# $ date: Factor w/ 582 levels "01/01/2009 01:58",..: 370 389 390 409
410 429 430 450 451 471 ..
?time1[,1]<-as.POSIXct(time1[,1],format="%d/%m/%Y %H:%M")
head(time1)
?# ?????????????? date
#1 2008-11-20 12:23:00
#2 2008-11-21 00:33:00
#3 2008-11-21 12:29:00
#4 2008-11-22 00:29:00
#5 2008-11-22 12:39:00
#6 2008-11-23 00:50:00
A.K.
________________________________
From: laila Aranda Romero <laila_zgz at hotmail.com>
To: arun <smartpink111 at yahoo.com>
Sent: Monday, July 8, 2013 4:29 PM
Subject: RE: [R] Need hep for converting date data in POSIXct
Arun,
?When I type dput(head(time,20), it appears this:
structure(list(date = structure(c(370L, 389L, 390L, 409L, 410L,
429L, 430L, 450L, 451L, 471L, 472L, 491L, 492L, 511L, 512L, 531L,
532L, 549L, 550L, 567L), .Label = c("01/01/2009 01:58",
"01/01/2009 13:57",
"01/02/2009 03:49", "01/02/2009 15:51", "01/03/2009
04:40", "01/03/2009 16:37",
"01/04/2009 04:21", "01/04/2009 16:33", "01/05/2009
04:33", "01/05/2009 16:31",
"01/06/2009 03:11", "01/06/2009 15:10", "01/07/2009
02:49", "01/07/2009 14:46",
"01/08/2009 02:44", "01/08/2009 14:44", "01/09/2009
01:05", "01/09/2009 13:14",
"01/12/2008 00:58", "01/12/2008 12:53", "02/01/2009
02:01", "02/01/2009 13:58",
"02/02/2009 03:59", "02/02/2009 15:58", "02/03/2009
04:37", "02/03/2009 16:25",
"02/04/2009 04:30", "02/04/2009 16:30", "02/05/2009
04:33", "02/05/2009 16:31",
"02/06/2009 02:52", "02/06/2009 14:57", "02/07/2009
02:47", "02/07/2009 14:51",
"02/08/2009 02:42", "02/08/2009 14:42", "02/09/2009
01:14", "02/09/2009 13:19",
"03/01/2009 01:52", "03/01/2009 13:57", "03/02/2009
03:55", "03/02/2009 15:56",
"03/03/2009 04:21", "03/03/2009 16:29", "03/04/2009
04:39", "03/04/2009 16:29",
"03/05/2009 04:27", "03/05/2009 16:24", "03/06/2009
02:53", "03/06/2009 14:48",
"03/07/2009 02:55", "03/07/2009 14:54", "03/08/2009
02:36", "03/08/2009 14:28",
"03/09/2009 01:32", "03/09/2009 13:37", "04/01/2009
01:57", "04/01/2009 13:57",
"04/02/2009 03:55", "04/02/2009 15:50", "04/03/2009
04:35", "04/03/2009 16:35",
"04/04/2009 04:28", "04/04/2009 16:36", "04/05/2009
04:43", "04/05/2009 16:43",
"04/06/2009 02:36", "04/06/2009 14:40", "04/07/2009
02:49", "04/07/2009 14:48",
"04/08/2009 02:40", "04/08/2009 14:38", "04/09/2009
01:45", "04/09/2009 13:54",
"05/01/2009 02:02", "05/01/2009 14:01", "05/02/2009
03:51", "05/02/2009 15:49",
"05/03/2009 04:35", "05/03/2009 16:40", "05/04/2009
04:36", "05/04/2009 16:29",
"05/05/2009 04:18", "05/05/2009 16:13", "05/06/2009
02:41", "05/06/2009 14:22",
"05/07/2009 02:50", "05/07/2009 14:57", "05/08/2009
02:31", "05/08/2009 14:28",
"05/09/2009 02:08", "05/09/2009 14:13", "06/01/2009
01:55", "06/01/2009 13:52",
"06/02/2009 03:54", "06/02/2009 15:55", "06/03/2009
04:39", "06/03/2009 16:40",
"06/04/2009 04:20", "06/04/2009 16:19", "06/05/2009
03:56", "06/05/2009 15:49",
"06/06/2009 02:20", "06/06/2009 14:26", "06/07/2009
03:10", "06/07/2009 15:05",
"06/08/2009 02:35", "06/08/2009 14:35", "06/09/2009
02:10", "06/09/2009 14:01",
"06/12/2008 12:27", "07/01/2009 01:54", "07/01/2009
13:38", "07/02/2009 03:49",
"07/02/2009 15:50", "07/03/2009 04:53", "07/03/2009
16:33", "07/04/2009 04:23",
"07/04/2009 16:22", "07/05/2009 03:33", "07/05/2009
15:34", "07/06/2009 02:40",
"07/06/2009 14:59", "07/07/2009 02:52", "07/07/2009
14:55", "07/08/2009 02:34",
"07/08/2009 14:37", "07/09/2009 01:59", "07/09/2009
13:45", "07/12/2008 00:28",
"07/12/2008 12:33", "08/01/2009 01:23", "08/01/2009
13:09", "08/02/2009 03:52",
"08/02/2009 15:51", "08/03/2009 04:33", "08/03/2009
16:47", "08/04/2009 04:26",
"08/04/2009 16:27", "08/05/2009 03:29", "08/05/2009
15:28", "08/06/2009 03:08",
"08/06/2009 14:58", "08/07/2009 03:02", "08/07/2009
15:01", "08/08/2009 02:38",
"08/08/2009 14:31", "08/09/2009 01:32", "08/09/2009
13:19", "08/12/2008 00:27",
"08/12/2008 12:29", "09/01/2009 00:57", "09/01/2009
12:52", "09/02/2009 03:45",
"09/02/2009 15:46", "09/03/2009 04:33", "09/03/2009
16:38", "09/04/2009 04:34",
"09/04/2009 16:25", "09/05/2009 03:27", "09/05/2009
15:13", "09/06/2009 02:50",
"09/06/2009 14:32", "09/07/2009 03:01", "09/07/2009
15:08", "09/08/2009 02:35",
"09/08/2009 14:31", "09/09/2009 01:08", "09/09/2009
13:05", "09/12/2008 00:34",
"09/12/2008 12:32", "10/01/2009 00:54", "10/01/2009
12:48", "10/02/2009 03:51",
"10/02/2009 15:45", "10/03/2009 04:41", "10/03/2009
16:30", "10/04/2009 04:21",
"10/04/2009 16:33", "10/05/2009 03:28", "10/05/2009
15:39", "10/06/2009 02:31",
"10/06/2009 14:50", "10/07/2009 03:03", "10/07/2009
15:03", "10/08/2009 02:43",
"10/08/2009 14:45", "10/09/2009 00:58", "10/09/2009
12:59", "10/12/2008 00:26",
"10/12/2008 12:30", "11/02/2009 03:54", "11/02/2009
15:59", "11/03/2009 04:32",
"11/03/2009 16:36", "11/04/2009 04:38", "11/04/2009
16:35", "11/05/2009 03:29",
"11/05/2009 15:19", "11/06/2009 02:56", "11/06/2009
14:55", "11/07/2009 02:57",
"11/07/2009 14:57", "11/08/2009 02:35", "11/08/2009
14:36", "11/09/2009 01:03",
"11/09/2009 13:08", "12/02/2009 03:54", "12/02/2009
15:55", "12/03/2009 04:36",
"12/03/2009 16:37", "12/04/2009 04:34", "12/04/2009
16:36", "12/05/2009 03:19",
"12/05/2009 15:17", "12/06/2009 02:36", "12/06/2009
14:36", "12/07/2009 03:07",
"12/07/2009 15:14", "12/08/2009 02:38", "12/08/2009
14:35", "12/09/2009 01:04",
"12/09/2009 13:06", "12/12/2008 12:33", "13/02/2009
04:00", "13/02/2009 15:56",
"13/03/2009 04:48", "13/03/2009 16:49", "13/04/2009
04:34", "13/04/2009 16:08",
"13/05/2009 03:02", "13/05/2009 14:55", "13/06/2009
02:31", "13/06/2009 14:30",
"13/07/2009 03:10", "13/07/2009 15:05", "13/08/2009
02:38", "13/08/2009 14:42",
"13/09/2009 01:05", "13/09/2009 12:59", "13/12/2008
00:28", "13/12/2008 12:28",
"14/02/2009 03:56", "14/02/2009 15:56", "14/03/2009
04:46", "14/03/2009 16:41",
"14/04/2009 04:10", "14/04/2009 16:34", "14/05/2009
02:57", "14/05/2009 15:00",
"14/06/2009 02:32", "14/06/2009 14:21", "14/07/2009
03:04", "14/07/2009 15:08",
"14/08/2009 02:45", "14/08/2009 14:43", "14/09/2009
00:59", "14/09/2009 13:03",
"14/12/2008 00:28", "14/12/2008 12:37", "15/02/2009
03:52", "15/02/2009 16:07",
"15/03/2009 04:37", "15/03/2009 16:37", "15/04/2009
04:36", "15/04/2009 16:28",
"15/05/2009 02:58", "15/05/2009 14:58", "15/06/2009
02:23", "15/06/2009 14:22",
"15/07/2009 03:12", "15/07/2009 15:04", "15/08/2009
02:39", "15/08/2009 14:40",
"15/09/2009 00:58", "15/09/2009 12:57", "15/12/2008
00:18", "15/12/2008 12:19",
"16/02/2009 04:26", "16/02/2009 16:29", "16/03/2009
04:48", "16/03/2009 16:42",
"16/04/2009 04:22", "16/04/2009 16:27", "16/05/2009
02:38", "16/05/2009 14:28",
"16/06/2009 02:17", "16/06/2009 14:31", "16/07/2009
03:06", "16/07/2009 14:59",
"16/08/2009 02:37", "16/08/2009 14:37", "16/09/2009
00:56", "16/09/2009 12:55",
"16/12/2008 00:20", "16/12/2008 12:17", "17/02/2009
04:19", "17/02/2009 16:20",
"17/03/2009 04:35", "17/03/2009 16:41", "17/04/2009
04:30", "17/04/2009 16:24",
"17/05/2009 02:20", "17/05/2009 14:21", "17/06/2009
02:46", "17/06/2009 14:46",
"17/07/2009 02:59", "17/07/2009 15:06", "17/08/2009
02:39", "17/08/2009 14:38",
"17/09/2009 00:55", "17/09/2009 12:49", "17/12/2008
00:20", "17/12/2008 12:22",
"18/02/2009 04:22", "18/02/2009 16:18", "18/03/2009
04:48", "18/03/2009 16:43",
"18/04/2009 04:29", "18/04/2009 16:30", "18/05/2009
02:10", "18/05/2009 14:18",
"18/06/2009 02:37", "18/06/2009 14:47", "18/07/2009
03:09", "18/07/2009 15:11",
"18/08/2009 02:40", "18/08/2009 14:19", "18/09/2009
00:51", "18/09/2009 12:49",
"18/12/2008 00:20", "18/12/2008 12:15", "19/01/2009
13:00", "19/02/2009 04:16",
"19/02/2009 16:15", "19/03/2009 04:46", "19/03/2009
16:41", "19/04/2009 04:25",
"19/04/2009 16:28", "19/05/2009 02:14", "19/05/2009
14:16", "19/06/2009 02:41",
"19/06/2009 14:47", "19/07/2009 03:09", "19/07/2009
15:03", "19/08/2009 02:34",
"19/08/2009 14:24", "19/09/2009 00:45", "19/09/2009
12:42", "19/12/2008 00:16",
"19/12/2008 12:16", "20/01/2009 01:23", "20/01/2009
13:53", "20/02/2009 04:24",
"20/02/2009 16:20", "20/03/2009 04:40", "20/03/2009
16:39", "20/04/2009 04:38",
"20/04/2009 16:38", "20/05/2009 02:15", "20/05/2009
14:18", "20/06/2009 02:50",
"20/06/2009 14:46", "20/07/2009 03:05", "20/07/2009
15:06", "20/08/2009 02:29",
"20/08/2009 14:18", "20/09/2009 00:37", "20/09/2009
12:35", "20/11/2008 12:23",
"21/01/2009 01:57", "21/01/2009 14:02", "21/02/2009
04:08", "21/02/2009 16:07",
"21/03/2009 04:34", "21/03/2009 16:34", "21/04/2009
04:33", "21/04/2009 16:29",
"21/05/2009 02:19", "21/05/2009 14:28", "21/06/2009
02:44", "21/06/2009 14:51",
"21/07/2009 03:05", "21/07/2009 15:03", "21/08/2009
02:19", "21/08/2009 14:21",
"21/09/2009 00:30", "21/09/2009 12:32", "21/11/2008
00:33", "21/11/2008 12:29",
"22/01/2009 02:00", "22/01/2009 14:14", "22/02/2009
04:07", "22/02/2009 15:59",
"22/03/2009 04:34", "22/03/2009 16:37", "22/04/2009
04:49", "22/04/2009 16:44",
"22/05/2009 02:29", "22/05/2009 14:44", "22/06/2009
02:50", "22/06/2009 14:47",
"22/07/2009 02:58", "22/07/2009 14:58", "22/08/2009
02:20", "22/08/2009 14:10",
"22/09/2009 00:29", "22/09/2009 12:31", "22/11/2008
00:29", "22/11/2008 12:39",
"23/01/2009 02:36", "23/01/2009 14:52", "23/02/2009
03:56", "23/02/2009 16:01",
"23/03/2009 04:52", "23/03/2009 16:52", "23/04/2009
04:25", "23/04/2009 16:30",
"23/05/2009 02:57", "23/05/2009 15:12", "23/06/2009
02:52", "23/06/2009 14:46",
"23/07/2009 02:55", "23/07/2009 14:49", "23/08/2009
02:04", "23/08/2009 13:53",
"23/09/2009 00:29", "23/09/2009 12:24", "23/11/2008
00:50", "23/11/2008 12:51",
"23/12/2008 12:45", "24/01/2009 03:04", "24/01/2009
15:11", "24/02/2009 04:10",
"24/02/2009 16:08", "24/03/2009 04:41", "24/03/2009
16:32", "24/04/2009 04:34",
"24/04/2009 16:19", "24/05/2009 03:14", "24/05/2009
15:25", "24/06/2009 02:38",
"24/06/2009 14:48", "24/07/2009 02:47", "24/07/2009
14:46", "24/08/2009 01:51",
"24/08/2009 13:48", "24/09/2009 00:21", "24/09/2009
12:16", "24/11/2008 00:44",
"24/11/2008 12:45", "24/12/2008 01:10", "24/12/2008
13:24", "25/01/2009 03:15",
"25/01/2009 15:24", "25/02/2009 04:08", "25/02/2009
16:17", "25/03/2009 04:28",
"25/03/2009 16:30", "25/04/2009 04:13", "25/04/2009
16:19", "25/05/2009 03:21",
"25/05/2009 15:30", "25/06/2009 02:45", "25/06/2009
14:49", "25/07/2009 02:42",
"25/07/2009 14:39", "25/08/2009 01:50", "25/08/2009
13:47", "25/09/2009 00:10",
"25/11/2008 00:40", "25/11/2008 12:40", "25/12/2008
01:18", "25/12/2008 13:39",
"26/01/2009 03:40", "26/01/2009 15:32", "26/02/2009
04:22", "26/02/2009 16:29",
"26/03/2009 04:30", "26/03/2009 16:26", "26/04/2009
04:19", "26/04/2009 16:14",
"26/05/2009 03:26", "26/05/2009 15:32", "26/06/2009
02:48", "26/06/2009 14:45",
"26/07/2009 02:35", "26/07/2009 14:43", "26/08/2009
01:48", "26/08/2009 13:33",
"26/11/2008 00:47", "26/11/2008 12:50", "26/12/2008
01:59", "26/12/2008 14:12",
"27/01/2009 03:31", "27/01/2009 15:44", "27/02/2009
04:36", "27/02/2009 16:43",
"27/03/2009 04:30", "27/03/2009 16:19", "27/04/2009
04:19", "27/04/2009 16:30",
"27/05/2009 03:32", "27/05/2009 15:32", "27/06/2009
02:44", "27/06/2009 14:49",
"27/07/2009 02:42", "27/07/2009 14:30", "27/08/2009
01:29", "27/08/2009 13:21",
"27/11/2008 00:45", "27/11/2008 12:45", "27/12/2008
02:06", "27/12/2008 14:11",
"28/01/2009 03:53", "28/01/2009 15:48", "28/02/2009
04:41", "28/02/2009 16:37",
"28/03/2009 04:15", "28/03/2009 16:14", "28/04/2009
04:33", "28/04/2009 16:32",
"28/05/2009 03:32", "28/05/2009 15:33", "28/06/2009
02:49", "28/06/2009 14:43",
"28/07/2009 02:30", "28/07/2009 14:30", "28/08/2009
01:19", "28/08/2009 13:18",
"28/11/2008 00:48", "28/11/2008 12:48", "28/12/2008
02:01", "28/12/2008 13:54",
"29/01/2009 03:52", "29/01/2009 16:05", "29/03/2009
04:15", "29/03/2009 16:21",
"29/04/2009 04:28", "29/04/2009 16:28", "29/05/2009
03:32", "29/05/2009 15:41",
"29/06/2009 02:46", "29/06/2009 14:49", "29/07/2009
02:27", "29/07/2009 14:43",
"29/08/2009 01:26", "29/08/2009 13:19", "29/11/2008
00:49", "29/11/2008 12:50",
"29/12/2008 02:01", "29/12/2008 13:50", "30/01/2009
04:15", "30/01/2009 16:03",
"30/03/2009 04:30", "30/03/2009 16:33", "30/04/2009
04:29", "30/04/2009 16:26",
"30/05/2009 03:40", "30/05/2009 15:40", "30/06/2009
02:46", "30/06/2009 14:51",
"30/07/2009 02:51", "30/07/2009 14:43", "30/08/2009
01:25", "30/08/2009 13:23",
"30/11/2008 00:50", "30/11/2008 12:53", "30/12/2008
01:50", "30/12/2008 14:03",
"31/01/2009 04:08", "31/01/2009 16:01", "31/03/2009
04:33", "31/03/2009 16:23",
"31/05/2009 03:31", "31/05/2009 15:27", "31/07/2009
02:42", "31/07/2009 14:39",
"31/08/2009 01:22", "31/08/2009 13:08", "31/12/2008
01:56", "31/12/2008 13:53"
), class = "factor")), .Names = "date", row.names = c(NA,
20L
), class = "data.frame")?
I hope?that you're asking for this!!!!! :)
Laila
> Date: Mon, 8 Jul 2013 12:26:41 -0700
> From: smartpink111 at yahoo.com
> Subject: Re: [R] Need hep for converting date data in POSIXct
> To: laila_zgz at hotmail.com
>
> Hi laila,
>
> You need to provide the full dput() output.? As I mentioned in my earlier
email in Nabble ( which I am not sure you got it), use dput() for a smaller
dataset.
> For eg.
> dput(head(dataset,20))
>
>
>
>
>
> ----- Original Message -----
> From: laila <laila_zgz at hotmail.com>
> To: r-help at r-project.org
> Cc:
> Sent: Monday, July 8, 2013 5:52 AM
> Subject: Re: [R] Need hep for converting date data in POSIXct
>
> 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+s789695n4671066h81 at n4.nabble.com
> To: laila_zgz at 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 at 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.
> ????