Message-ID: <CA+8X3fUcMN=zasRWSewwuz3=Mz2DOWFxz_L34WbWs_o0rTZE3w@mail.gmail.com>
Date: 2019-02-17T01:21:50Z
From: Jim Lemon
Subject: Extending my code
In-Reply-To: <F31D629D-4464-4C2F-9C6C-F7AA0C0E7EF7@dcn.davis.ca.us>
Hi Ogbos,
It may be easier to use strptime:
dta<-data.frame(year=rep(2005,5),month=rep("05",5),
day=c("01","06","11","16","21"),
hour=c(2,4,6,8,10),minute=rep(0,5),second=rep(0,5),value=1:5)
dta$Ptime<-strptime(paste(paste(dta$year,dta$month,dta$day,sep="-"),
paste(dta$hour,dta$minute,dta$second,sep=":")),"%Y-%m-%d %H:%M:%S")
plot(dta$Ptime,dta$value)
text(strptime("2005-05-04 09:00:00","%Y-%m-%d %H:%M:%S"),4,"b")
Jim
> On February 16, 2019 1:08:38 PM PST, Ogbos Okike <giftedlife2014 at gmail.com> wrote:
> >Dear Jeff,
> >One more problem please.
> >
> >When I used as.Date(ISOdate(dta$year, dta$month, dta$day,dta$hour)) to
> >handle date, I could use text(as.Date("2005-03-13"),-9,"b") to label
> >my plot.
> >
> >Now that I am using as.POSIXct(ISOdatetime(year,
> >month,day,hour,0,0))), can you please tell me how to text "b" on the
> >point corresponding with 1960-05-04 09:00:00 on my plot.
> >
> >Many thanks for your extra time.
> >
> >Best wishes
> >Ogbos