[R] sdate<-as.POSIXct(strptime(date,format="%m/%d/%Y %H:%M"))
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Jan 1 13:29:07 CET 2009
See last line of every message to r-help or read R News 4/1 which gives
info on this.
On Wed, Dec 31, 2008 at 2:20 PM, Graves, Gregory <ggraves at sfwmd.gov> wrote:
> Newbie here~
>
> I've spent a ton of time on this, but have to admit I am stuck. I've tried various combinations of strptime and the package CHRON, but still can't get there.
>
> My simple task is that I want to plot salinity (S1 or S2) on y-axis and time on x-axis, but I want to use a lay-understandable representation of time (not Julian). If I use the following command, I can make a plot using "plot(S1~sdate)", where:
>
> sdate<-as.POSIXct(strptime(date,format="%m/%d/%Y %H:%M"))
>
> ... however, every 00:00 time winds up being an NA. Here is an excerpt of the input data (this is a HUGE file):
>
> index Date Julian S1 S2
> 24985 11/19/2006 00:00 39040.01 20.40 22.11 (this line winds up being an NA)
> 24986 11/19/2006 01:00 39040.05 20.42 22.22
> 24987 11/19/2006 02:00 39040.09 20.60 22.29
> 24988 11/19/2006 03:00 39040.14 20.62 22.21
> 24989 11/19/2006 04:00 39040.18 20.75 22.39
>
> ... an excerpt of the variable "sdate" winds up looking like this:
>
> [35017] NA "2007-09-08 01:00:00 EDT"
> [35019] "2007-09-08 01:00:00 EDT" "2007-09-08 10:00:00 EDT"
> [35021] "2007-09-08 10:00:00 EDT" "2007-09-08 11:00:00 EDT"
> [35023] "2007-09-08 11:00:00 EDT" "2007-09-08 12:00:00 EDT"
> [35025] "2007-09-08 02:00:00 EDT" "2007-09-08 02:00:00 EDT"
> [35027] "2007-09-08 03:00:00 EDT" "2007-09-08 03:00:00 EDT"
> [35029] "2007-09-08 04:00:00 EDT" "2007-09-08 04:00:00 EDT"
> [35031] "2007-09-08 05:00:00 EDT" "2007-09-08 05:00:00 EDT"
> [35033] "2007-09-08 06:00:00 EDT" "2007-09-08 06:00:00 EDT"
> [35035] "2007-09-08 07:00:00 EDT" "2007-09-08 07:00:00 EDT"
> [35037] "2007-09-08 08:00:00 EDT" "2007-09-08 08:00:00 EDT"
> [35039] "2007-09-08 09:00:00 EDT" "2007-09-08 09:00:00 EDT"
> [35041] NA "2007-09-09 01:00:00 EDT"
> [35043] "2007-09-09 01:00:00 EDT" "2007-09-09 10:00:00 EDT"
> [35045] "2007-09-09 10:00:00 EDT" "2007-09-09 11:00:00 EDT"
> [35047] "2007-09-09 11:00:00 EDT" "2007-09-09 12:00:00 EDT"
> [35049] "2007-09-09 02:00:00 EDT" "2007-09-09 02:00:00 EDT"
> [35051] "2007-09-09 03:00:00 EDT" "2007-09-09 03:00:00 EDT"
> [35053] "2007-09-09 04:00:00 EDT" "2007-09-09 04:00:00 EDT"
> [35055] "2007-09-09 05:00:00 EDT" "2007-09-09 05:00:00 EDT"
> [35057] "2007-09-09 06:00:00 EDT" "2007-09-09 06:00:00 EDT"
> [35059] "2007-09-09 07:00:00 EDT" "2007-09-09 07:00:00 EDT"
> [35061] "2007-09-09 08:00:00 EDT" "2007-09-09 08:00:00 EDT"
> [35063] "2007-09-09 09:00:00 EDT" "2007-09-09 09:00:00 EDT"
>
>
> Gregory A. Graves
> Lead Scientist
> RECOVER Division
> Everglades Restoration Resource Area
> South Florida Water Management District
> Phones: DESK: 561 / 681 - 2563 x3730
> CELL: 561 / 719 - 8157
>
>
> [[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