[R] WaveletComp with as.POSIXct Showing Error on Date for: 2000-01-01 Format

MacQueen, Don macqueen1 at llnl.gov
Thu Dec 15 20:27:57 CET 2016


Your code is nearly unreadable, probably because you posted in HTML instead of plain text. Plain text is the standard expected on R-help.

The only apparent date/time conversion in your code is the use of as.POSIXct(). You are missing a closing quote mark after the date.

If I fix that, then on my system as.POSIXct() succeeds:

> seq(as.POSIXct("2002-01-01"), by = "hour", length.out = 5)
[1] "2002-01-01 00:00:00 PST" "2002-01-01 01:00:00 PST"
[3] "2002-01-01 02:00:00 PST" "2002-01-01 03:00:00 PST"
[5] "2002-01-01 04:00:00 PST"

Your warning (not error) messages refer to an unknown timezone. So check your timezone, for example:

> Sys.getenv('TZ')
[1] "US/Pacific"

I hope this helps.
-Don


On 12/13/16, 9:33 AM, "R-help on behalf of Muhammad Anees" <r-help-bounces at r-project.org on behalf of anec at aneconomist.com> wrote:

    Dear All,
    
    I tried to find an answer everywhere including stackoverflows and manuals
    but there is no specific solution that might have helped. Hence, I am sure
    you will bear with me for this first query.
    
    I am trying to replicate production of Wavelet Coherency using the
    following codes: I dont know why the two errors/warnings appear and my
    resultant figures dont show up the time as I use the format of Date as
    2000-01-01
    
    Code used is:
    
    > library(WaveletComp)> x<- API> y<- TFS> my.data = data.frame(x = x, y = y)> my.wc = analyze.coherency(my.data, my.pair = c("x","y"),+                           loess.span = 0,+                           dt = 1/24, dj = 1/100,+                           lowerPeriod = 1/2,+                           make.pval = T, n.sim = 10)> wc.image(my.wc, n.levels = 250,+          siglvl.contour = 0.1, siglvl.arrow = 0.05,+          legend.params = list(lab = "cross-wavelet power levels"))> wc.image(my.wc, n.levels = 250, color.key = "interval",+          siglvl.contour = 0.1, siglvl.arrow = 0.05, which.arrow.sig = "wt",+          legend.params = list(lab = "cross-wavelet power levels"))> wc.image(my.wc, which.image = "wc", n.levels = 250,+          siglvl.contour = 0.1, siglvl.arrow = 0.05,+          legend.params = list(lab = "wavelet coherence levels"))> my.date = seq(as.POSIXct("2002-01-01),+               by = "hour", length.out = 24*96)########################################
    ########################################
    
    
    Warning messages:1: In strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
      unknown timezone '%F %T'2: In as.POSIXct.POSIXlt(x) : unknown
    timezone '%F %T'3: In strptime(x, f, tz = tz) : unknown timezone '%F
    %T'4: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
      unknown timezone '%F %T'
    
    ########################################
    ########################################
    
    I would be happier to see a suggestion for removing this warning and
    get the results as the time axis showing Date as in the data on the
    figures of my output from above.
    
    Regards
    
    
    
    ------------------------------
    Muhammad Anees
    Assistant Professor,
    The Econometrician &
    Statistical Consultant @
    www.aneconomist.com
    
    	[[alternative HTML version deleted]]
    
    ______________________________________________
    R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
    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