[R] Need hep for converting date data in POSIXct
arun
smartpink111 at yahoo.com
Sun Jul 14 22:15:54 CEST 2013
HI,
Try this:
Geo<- read.table(text="
long lat.comp confianza
9.31 -42.72 3
11.66 -40.63 9
10.88 -38.60 9
10.72 -37.86 9
13.06 -39.04 9
16.02 -38.51 6
",sep="",header=TRUE)
col1<- as.numeric(factor(Geo$confianza))
with(Geo, plot(long,lat.comp,col=col1))
A.K.
________________________________
From: laila Aranda Romero <laila_zgz at hotmail.com>
To: arun <smartpink111 at yahoo.com>
Sent: Sunday, July 14, 2013 3:28 PM
Subject: RE: [R] Need hep for converting date data in POSIXct
Arun,
I contact you again because I have another difficulty with R. I posted the following message but it hasn't been accepted by the fórum filter. So I'm not sure if you can see it!!!!
I have the following database:
head(Geo)
long lat.comp confianza
9.31 -42.72 3
11.66 -40.63 9
10.88 -38.60 9
10.72 -37.86 9
13.06 -39.04 9
16.02 -38.51 6
I am trying to plot Geo$ long versus Geo$lat.comp with diferent colours regarding the number of Geo$confianza. I don't know how to make the palette and tell R to plot the points using this palette in the same graph.
Regards,
Laila
> Date: Thu, 11 Jul 2013 03:10:40 -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,
> No problem.
> Regards,
> Arun
>
>
>
>
> ----- Original Message -----
> From: laila <laila_zgz at hotmail.com>
> To: r-help at r-project.org
> Cc:
> Sent: Thursday, July 11, 2013 3:38 AM
> Subject: Re: [R] Need hep for converting date data in POSIXct
>
> Arun, the last email has been sent it by itself. I have just found the problem and it works. Thank very much!!!!
>
> Date: Wed, 10 Jul 2013 19:36:43 -0700
> From: ml-node+s789695n4671274h29 at n4.nabble.com
> To: laila_zgz at hotmail.com
> Subject: Re: Need hep for converting date data in POSIXct
>
>
>
>
>
> Hi,
>
> I guess the error message:
>
> > vmask(lat,lon,time,vmax=25)
>
> Error en vmask(lat, lon,
>
> time, vmax = 25) : objeto 'lat' no encontrado
>
>
> says that you have not defined the object 'lat'.
>
>
> time<-subset(Geo, select =date)
>
> time[,1]<- as.POSIXct(time[,1],format="%d/%m/%Y %H:%M")
>
> location<- subset(Geo,select=c(lat.comp,long))
>
> time1<- time[,1]
>
> lat<- location[,1]
>
> long<- location[,2]
>
> library(argosfilter)
>
> vmask(lat,long,time1,25)
>
> #[1] "end_location" "end_location" "not" "not" "end_location"
>
> #[6] "end_location"
>
>
> A.K.
>
> ________________________________
>
> From: laila Aranda Romero <[hidden email]>
>
> To: arun <[hidden email]>
>
> Sent: Wednesday, July 10, 2013 6:21 PM
>
> Subject: RE: [R] Need hep for converting date data in POSIXct
>
>
>
>
>
>
> Hi,
>
>
> The code:
>
>
> 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"))
>
> View(Geo)
>
> location=subset(Geo, select= c(lat.comp,long))
>
> time=subset(Geo, select =c(date))
>
> time[,1]<-as.POSIXct(time[,1],format="%d/%m/%Y
>
> %H:%M")
>
> vmask(lat,lon,time,vmax=25)
>
>
>
>
>
> The example: library(argosfilter)
>
> > setwd("C:/Users/Usuario/Dropbox/LailaAranda/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"))
>
> > str(Geo)
>
>
> 'data.frame': 582
>
> obs. of 12 variables: $
>
> type : Factor w/ 2 levels
>
> "midnight","noon": 2 1 2 1 2 1 2 1 2 1 ...
>
> $
>
> date : Factor w/ 582 levels
>
> "01/01/2009 01:58",..: 370 389 390 409 410 429 430 450 451 471 ...
>
>
> $
>
> secs : num 39773 39773 39774 39774 39775 ... $
>
> Trans1 : Factor w/ 186 levels
>
> "04:06","04:08",..: 14 17 17 16 16 28 28 19 19 15 ...
>
> $
>
> Trans2 : Factor w/ 159 levels
>
> "00:01","00:03",..: 30 30 28 28 34 34 35 35 36 36 ...
>
> $
>
> lat.sta : num -42.7 -39.1 -37.8 -37.9 -41.2 ...
>
> $
>
> lat.comp : num -42.7 -40.6 -38.6 -37.9
>
> -39 ...
>
>
> $
>
> long : num 9.31 11.66 10.88 10.72 13.06 ...
>
> $ dist : num
>
> 0 0 127 45 131 ...
>
> $ rumbo
>
> : num 0 0 -16.49 -9.64 -57.22 ...
>
> $ velocidad: num 0 0 10.64 3.75 10.75 ... $ confianza: int 3 9 9 9 9 6 6 9 9 9
>
> ...
>
> > head(Geo)
>
> type date secs Trans1 Trans2 lat.sta lat.comp long
>
> dist
>
> 1 noon 20/11/2008 12:23 39772.52
>
> 04:59 19:47 -42.72
>
> -42.72 9.31 0.00
>
> 2 midnight 21/11/2008 00:33 39773.02 05:18
>
> 19:47 -39.14 -40.63 11.66 0.00
>
> 3 noon 21/11/2008 12:29 39773.52
>
> 05:18 19:41 -37.82
>
> -38.60 10.88 127.02
>
> 4 midnight 22/11/2008 00:29 39774.02 05:17
>
> 19:41 -37.86 -37.86 10.72
>
> 45.04
>
> 5 noon 22/11/2008 12:39 39774.53
>
> 05:17 20:00 -41.21
>
> -39.04 13.06 130.78
>
> 6 midnight 23/11/2008 00:50 39775.03 05:41
>
> 20:00 -36.56 -38.51 16.02 142.06
>
> rumbo
>
> velocidad confianza
>
> 1
>
> 0.00 0.00 3
>
> 2
>
> 0.00 0.00 9
>
> 3 -16.49
>
> 10.64 9
>
> 4
>
> -9.64 3.75 9
>
> 5 -57.22
>
> 10.75 9
>
> 6
>
> 77.07 11.66 6
>
> > location=subset(Geo, select=
>
> c(lat.comp,long))
>
>
> > str(location)
>
> 'data.frame': 582
>
> obs. of 2 variables:
>
> $lat.comp: num -42.7 -40.6 -38.6 -37.9 -39 ...
>
> $long : num 9.31 11.66 10.88 10.72 13.06 ...
>
> > head(location)
>
>
> lat.comp long
>
> 1
>
> -42.72 9.31
>
> 2
>
> -40.63 11.66
>
> 3
>
> -38.60 10.88
>
> 4
>
> -37.86 10.72
>
> 5
>
> -39.04 13.06
>
> 6
>
> -38.51 16.02
>
>
> > time=subset(Geo, select =c(date))
>
> > time[,1]<-as.POSIXct(time[,1],format="%d/%m/%Y
>
> %H:%M")
>
> > str(time)
>
> 'data.frame': 582
>
> obs. of 1 variable:
>
> $ date:
>
> POSIXct, format: "2008-11-20 12:23:00" "2008-11-21
>
> 00:33:00" ...
>
> > head(time)
>
> 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
>
> > vmask(lat,lon,time,vmax=25)
>
> Error en vmask(lat, lon,
>
> time, vmax = 25) : objeto 'lat' no encontrado
>
>
> ______________________________________________
>
> [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-tp4671059p4671274.html
>
>
>
> To unsubscribe from Need hep for converting date data in POSIXct, click here.
>
> NAML
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Need-hep-for-converting-date-data-in-POSIXct-tp4671059p4671301.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.
>
More information about the R-help
mailing list